|
| 1 | +Assignments |
| 2 | +----------- |
| 3 | +----------- |
| 4 | + |
| 5 | +This is a list of projects to do and things to build in order to completely understand [Algorithms](http://www.cse.iitd.ernet.in/~naveen/courses/CSL630/all.pdf) by Sanjoy Dasgupta, Christos Papadimitriou, and Umesh Vazirani. |
| 6 | + |
| 7 | +Feel free to add to it should you think of any useful exercises or find any cool resources. |
| 8 | + |
| 9 | +You may build these in any langauge. I suggest a dynamic language like Python or JavaScript. These are good for interviews because they're generally more permissive, so things can be written in them with fewer lines of code (better for cramming stuff onto a whiteboard). |
| 10 | + |
| 11 | +For any algorithm you write, you MUST include a comment with it's runtime before the function decalaration. |
| 12 | + |
| 13 | +### These are not made to be easy. |
| 14 | + |
| 15 | +Day 00 |
| 16 | +------ |
| 17 | + |
| 18 | +* mini-calc: write a function that takes two numbers of ANY SIZE with an operator in between them and outputs the result of the operation. |
| 19 | + |
| 20 | +⋅⋅* only need to handle +, -, *, and / |
| 21 | + |
| 22 | +⋅⋅* examples: ./mini-calc 123456789000 + 987654321000 |
| 23 | + |
| 24 | +⋅⋅* 1111111110000 |
| 25 | + |
| 26 | +⋅⋅* ./mini-calc 217340927348 * 982734927340 |
| 27 | + |
| 28 | +⋅⋅* 213588520445344998894320 |
| 29 | + |
| 30 | +⋅⋅* ./mini-calc 2 / 2 |
| 31 | + |
| 32 | +⋅⋅* 1 |
| 33 | + |
| 34 | +⋅⋅* You need not implement full error-handling (do watcha want, Moulinette ain't gunna get yat) |
| 35 | + |
| 36 | +* implement a hash table/map |
| 37 | + |
| 38 | +⋅⋅* [wikipedia](https://en.wikipedia.org/wiki/Hash_table) |
| 39 | + |
| 40 | +⋅⋅* would be wise to implement the hash function used in the hash literal for whichever language your using (assuming you aren't using C... if you are then use whichever pleases you!) |
| 41 | + |
| 42 | +⋅⋅* implement the following functions (make methods of the hash table object if OOP) |
| 43 | + |
| 44 | +⋅⋅* you DO NOT need to name them like this - feel free to use whatever convention your langauge suggests. |
| 45 | + |
| 46 | +⋅⋅* hash_map_name.len returns the total number of elements in the map |
| 47 | + |
| 48 | +⋅⋅* hash_map_name.get_val(key_name) returns the value associated with key_name or NULL if key_name doesn't exist in hash map |
| 49 | + |
| 50 | +⋅⋅* hash_map_name.set_val(key_name, val_name) sets the value associated with key_name to val_name |
| 51 | + |
| 52 | +⋅⋅* hash_map_name.pop(key_name) removes the key_name from the map and returns the value associated with key_name |
| 53 | + |
| 54 | +⋅⋅* hash_map_name.keys() returns an array of all the keys in hash map |
| 55 | + |
| 56 | +⋅⋅* hash_map_name.values() returns an array of all the values in hash map |
| 57 | + |
| 58 | +* find_sum: given an unsorted array of integers, find a pair that sum to a given number and return their locations in the array |
| 59 | + |
| 60 | +⋅⋅* use your hash table for fastest time! (To be complete, this must be done :) ) |
| 61 | + |
| 62 | +⋅⋅* the last number passed via commandline will be the desired sum |
| 63 | + |
| 64 | +⋅⋅* examples: ./find_sum 1 2 3 4 5 8 |
| 65 | + |
| 66 | +⋅⋅* (2, 4) |
| 67 | + |
| 68 | +⋅⋅* ./find_sum 1 2 3 4 5 6 |
| 69 | + |
| 70 | +⋅⋅* (0, 4) OR (1, 3) - you don't need to write 'OR', you can just give either answer and still be considered correct |
| 71 | + |
| 72 | +⋅⋅* ./find_sum 1 2 3 4 5 10 |
| 73 | + |
| 74 | +⋅⋅* NO SOLUTION |
| 75 | + |
| 76 | +* (bonus) implement RSA encryption |
| 77 | + |
| 78 | +⋅⋅* [wikipedia](https://simple.wikipedia.org/wiki/RSA_(algorithm)) |
| 79 | + |
| 80 | +⋅⋅* Good luck ;) |
0 commit comments