-
Notifications
You must be signed in to change notification settings - Fork 1
slib:datalib
DataLib is a library for managing arbitrary amounts of data with relative speed and efficiency.
Subroutines for creating and searching hash tables, which are sorted tables that store values under names
Creates the header for a hashTable at headerPointer with indicies as the target number of indicies for the hashTable. The total length of the hashTable is 2 * indicies + 4
, which includes the header, the lookup portion of the table, and the value portion of the table. length is not the total length of the table, but rather the number of occupied indicies.
returns headerPointer
Searches the hash table at hashTablePointer for searchTerm in the lookup portion of it. It returns the value in the value portion associated with the searchTerm.
returns value associated by the hash table with searchTerm, or 1 if it could not be found development version
Inserts lookupValue in a sorted way in the lookup portion of the hashTable at hashTablePointer and insertValue in an unsorted way at the same index in the value portion of the table. This is designed to work very well with the 16-bit hashing algorithm crp.dsHash.
under development
Subroutines for creating and searching sorted tables
Inserts insertValue into the sorted table at tableLocation of tableLength, maintaining the sortedness of the table.
returns location of insert, or 1 if the value is already present in the table
Performs a binary search on the table at tableLocation (with length tableLength) for searchTerm and returns the memory location
Returns the index at which searchTerm should be inserted to keep the table at tableLocation with length tableLength sorted.
Inserts insertValue at insertLocation and pushes the value it would replace upward in memory recursively until only a null is overwritten. returns insertLocation