Giter VIP home page Giter VIP logo

cs4500-a1-part2's People

Contributors

gyroknight avatar mhebes avatar

Watchers

 avatar  avatar  avatar

cs4500-a1-part2's Issues

Removal of SortedList?

Would it be possible to remove sorted list from the specification? We don't believe it is needed for this, and there is also no way to compare two Objects, so the idea of sorting them is somewhat nonsensical.

Design and ownership of key and value lists

Based on the tests, it seems that the only thing that maps can own is the key and value lists. I think that's too forceful a decision to make.

The reason that I say key and value lists are the only things that can be owned by the map is that the deletes in the clone test are only freeing those two lists for map1. Other heap memory used by the map is not freed.

If a map can only own two lists, it'll be too vulnerable to the result of hash collisions, and/or not get the expected performance.

The simple fix is to simply change all map declaration to map pointer declarations in the test file. Calling delete on the pointers will free all the heap memory used by the map.

Get keys and values: eliminate methods?

It seems a bad idea to have these two methods when we potentially could be putting millions of key-value pairs into the map.

We will be doing a lot of copying for little value since we usually just want to find out if a key is among the keys in the map, or if a value is among the values.

Map's clone method: design does not match test

According to the design, the clone method makes a shallow copy and does not copy keys and values. However, the test implies that the clone method also clones keys and values. Please clarify.

Discrepancy between specs and tests

In line 43 of the tests, we are calling the get() method of List in a loop. In the specs for list, the get method returns a copy of the object. But we are never freeing these copies in the tests.

Missing assert #include

Hey guys, I think you're missing an #include in your spec.
#include <assert.h> in order to be able to use assert()

Add List Include

Can you please add an includes for list.h in the map.h spec for compilation? Thanks!

Use Array instead of list

Hey all - wanted to ask your opinions on the spec.

Map.keys() and Map.values( ) return a List object - but List is just an alias for Array.

Since you're implementing Array, I don't see any reason you need to implement List as well.

I want to change those methods to return your Array instead of my List, but I don't know what the best way to do that is. Thoughts?

Asserts in tests

Hey guys, after your recent changes to the test file, should lines 379 and 384 have the opposite condition? Since d1 should now be expected to be in both keys and values?

Thanks.

Shallow clone ownership

If map2 is a shallow copy of map1, who has ultimate ownership of the keys and values since they need to point to the same objects per last comment by gyroknight on #4? In other words, which object is responsible for freeing them?

List constructor: requires no allocation at creation

Map is required to return List objects when asked about its keys and values. This brings List within the scope of map specification.

According to the comment, it is required to not allocate any additional memory for potential list contents. It also requires the size of the list to be 1.

This seems mutually incompatible. Please change the initial List size to 0, or allow the allocation of some memory at construction.

Implementation already exists

For string.h and list.h we included our implementations from previous assignments. These should be removed. Doing this now, stand by.

Missing include

Hi guys, just a small thing. I think you're missing #include <stdlib.h> in your test file. It's needed to get size_t.

Remove print from map

Since the new Object and String APIs no longer include a print function, it should probably also be removed from Map.

List Initialization

I can't figure out how to populate the list object, maybe the constructor could take an array or could you provide an add(...) function?

Adding Object methods back to List

We saw that you removed the methods that List inherits from the Object class (i.e. equals and hash) so could you just add those back, since those should be stubs in any class that inherits from Object?

Fix incorrect test assertions

There are a few assertions currently in your test file that won't pass.

On line 341: the size of map1 should be equal to 2, not 3, since the third put call is replacing the pairing of 'c' to 'd' with 'c' to 'a', not adding a new entry.

On line 368: the same issue as on line 341.

On lines 373 and 374: the keys and values lists for the map should both be of size 2 because the map itself only has two entries.

Removal of Implementations

Could you all remove the stub implementations included in the spec since this should only be an interface? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.