This shows you the differences between two versions of the page.
|
dss:assignment [2019/04/17 19:23] eduard.staniloiu created |
dss:assignment [2020/05/03 22:42] (current) eduard.staniloiu [Testing and grading] |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ^ Method ^ Description ^ | ^ Method ^ Description ^ | ||
| - | | add <word> | add a new word to the hashtable, or increase the number of occurrences | | + | | this(size_t initialLength); | a constructor that takes the initial size of the hashtable | |
| - | | remove <word> | remove the word from the hashtable; the word doesn't necessarily have to exist | | + | | size_t length(); | returns the size of the hashtable | |
| - | | get <word, defaultValue> | return the number of occurances for the given word, or defaultValue if the word doesn't exist in the hashtable | | + | | void add(string word); | add a new word to the hashtable, or increase the number of occurrences | |
| - | | clear | clear the table | | + | | void remove(string word); | remove the word from the hashtable; the word doesn't necessarily have to exist | |
| - | | resizeDouble | double the size of the hashtable | | + | | size_t get (string word, size_t defaultValue = 0); | return the number of occurances for the given word, or defaultValue if the word doesn't exist in the hashtable | |
| - | | resizeHalve | halve the size of the hashtable. Excess memory must be freed. | | + | | void clear(); | clear the table. | |
| - | | bucketToString <index_bucket> | returns a string containing all the pairs <word, numOcc>, separated by one space (" ") character | | + | | void resizeDouble(); | double the size of the hashtable | |
| - | | toString | returns a string containing all the pairs <word, numOcc> in the hashtable, starting with index 0 | | + | | void resizeHalve(); | halve the size of the hashtable. Excess memory must be freed. | |
| + | | string bucketToString(size_t index_bucket); | returns a string containing all the pairs <word, numOcc>, separated by one space (" ") character | | ||
| + | | string toString(); | returns a string containing all the pairs <word, numOcc> in the hashtable, starting with index 0 | | ||
| - | The implemented hashtable will contain SIZE buckets. Each bucket will contain a pair consisting of the word and number of occurrences. | + | The implemented hashtable must be named **Hashtable** and it will contain SIZE buckets. Each bucket will contain a pair consisting of the word and number of occurrences. |
| ===== Implementation details ===== | ===== Implementation details ===== | ||
| - | **1.** You are not allowed to use the built-in Associative Array type, nor other library implementations of a hashtable | + | **1.** You are not allowed to use the built-in Associative Array type, nor other library implementations of a hashtable. |
| - | **2.** You are allowed to use any other features/built-in types that the language provides | + | **2.** You are allowed to use any other features/built-in types that the language provides. |
| **3.** You must use the globally available `hashOf` function, as your hash function: | **3.** You must use the globally available `hashOf` function, as your hash function: | ||
| Line 28: | Line 30: | ||
| </code> | </code> | ||
| - | **4.** Inserting in a bucket list always adds at the end of the list | + | **4.** Inserting in a bucket list always adds at the end of the list. |
| - | **5.** When halving, if the size is odd **(2k + 1)**, the new size must be **k** | + | **5.** When halving, if the size is odd **(2k + 1)**, the new size must be **k**. |
| + | **6.** We encourage you to use [[https://tour.dlang.org/tour/en/gems/unittesting|unittest blocks]] to test your implementation. | ||
| + | |||
| + | ===== Deployment ===== | ||
| + | |||
| + | You are required to write a small Linux Bash script, **named** `dmd_setup.sh`, that will setup the test environment. | ||
| + | The script must do the following sequence of actions: | ||
| + | |||
| + | **1.** Clone the DLang repositories: dmd compiler, druntime, standard library (Phobos). | ||
| + | |||
| + | **2.** Build each component. | ||
| + | |||
| + | **3.** Do the necessary environmental setup such that the command `custdmd hashtable.d` will compile the file `hashtable.d` using the binaries obtained at step **2**. | ||
| + | |||
| + | For detailed information about how to achieve the above, read the [[https://wiki.dlang.org/Starting_as_a_Contributor|Starting as a contributor]] and [[https://wiki.dlang.org/Building_under_Posix|Building under Posix]] guides. | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | |||
| + | **1.** The hashtable implementation must reside in a single file, named `hashtable.d`. | ||
| + | |||
| + | **2.** The environment setup script must be named `dmd_setup.sh`. | ||
| + | |||
| + | ===== Testing and grading ===== | ||
| + | |||
| + | The assignment must be submitted as a `.zip` archive on [[https://vmchecker.cs.pub.ro/ui/#DLANG|VMChecker]] for the `DLang` course. The archive must have the following naming convention: **firstName-lastName.zip**. The archive will contain the `hashtable.d` and `dmd_setup.sh` files. | ||
| + | |||
| + | The final grade will consist of: | ||
| + | |||
| + | * Test suite - 80% | ||
| + | * Coding style - 20% | ||
| + | |||
| + | The use of idiomatic D code will be highly appreciated. | ||
| + | |||
| + | ===== Contact ===== | ||
| + | |||
| + | Make sure you are subscribed to [[https://groups.google.com/forum/#!forum/d-summer-school-upb|forum]]. | ||
| + | For any questions please use the forum. | ||