summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-06-17hashtable: foreach works on const hashtablesHEADmasterAndrea Canciani1-2/+2
The foreach function iterates over all of the elements and calls a function which is guaranteed to make no modification to the table, hence the whole loop never changes the hashtable. This makes it possible to nest two loops over the same hashtable without manual casting.
2013-04-27list: Add sort and merge functionsAndrea Canciani1-0/+135
Add functions to efficiently sort lists and to merge sorted lists. The sort function is a bottom-up mergesort (guaranteed O(n lg n)).
2013-04-27list: Fix implementationAndrea Canciani1-9/+2
Fix some typos and copy/paste errors.
2013-04-27hashtable: Fix free slot threshold handlingAndrea Canciani1-1/+1
Make threshold computation consistent with the comment. Fixes wrong behavior when num_slots < 8 (which resulted in 0 free slots).
2013-04-27hashtable: Never check equality of removed data when looking upAndrea Canciani1-1/+1
Removed elements should not terminate the lookup routine, but they should never be used for comparison, because the equality function can legitimately assume that both its arguments are valid.
2013-04-14hashtable: Silence unused variable warningsAndrea Canciani1-1/+1
The i variable is never used and (as expected) compilers warn about this. Fixed by removing the variable declaration.
2013-04-03Add hashtableAndrea Canciani2-0/+402
Add implementation of open-addressing hashtable (collisions are resolved with linear probing by means of double hashing).
2013-04-03Add list implementationAndrea Canciani1-0/+128
Add simple implementation of doubly-linked list.
2013-03-01First commitAndrea Canciani1-0/+1