mp_sketching
Supreme sketching
|
Support functions that the autograder will have access to You should not modify this file (it wont be included in your submission) More...
Functions | |
std::string | file_to_string (const std::string &filename) |
Takes a filename and reads in all the text from the file Newline characters are also just characters in ASCII. More... | |
std::string | trim_right (const std::string &str) |
Functions for the removal of whitespace to the left or right of a string (or both) More... | |
std::string | trim_left (const std::string &str) |
std::string | trim (const std::string &str) |
int | split_string (const std::string &str1, char sep, std::vector< std::string > &fields) |
Given a string and character, split the string by the character and store in a vector A 'split' string treats the character as a breakpoint and creates a separate item in the output vector for each substring. More... | |
std::vector< int > | readFile (std::string fname) |
Given a filename to a line-separated text file, create a vector of integers where each row in the text file is an entry in the vector. More... | |
uint64_t | hash_seeded (const int *key, uint64_t seed) |
Built using MurmurHash3 A generalizable hash function that can be passed different seed inputs. More... | |
uint64_t | hash_1 (int key) |
Built using MurmurHash3 Specific hash functions that can be used without specifying seeds The autograder will be built around these to limit the args that need to be passed. More... | |
uint64_t | hash_2 (int key) |
uint64_t | hash_3 (int key) |
uint64_t | hash_4 (int key) |
uint64_t | hash_5 (int key) |
uint64_t | hash_6 (int key) |
uint64_t | hash_500 (int key) |
uint64_t | hash_1000 (int key) |
uint64_t | simple (int key) |
Support functions that the autograder will have access to You should not modify this file (it wont be included in your submission)
std::string file_to_string | ( | const std::string & | filename | ) |
Takes a filename and reads in all the text from the file Newline characters are also just characters in ASCII.
filename | The name of the file that will fill the string |
uint64_t hash_1 | ( | int | key | ) |
Built using MurmurHash3 Specific hash functions that can be used without specifying seeds The autograder will be built around these to limit the args that need to be passed.
Ex: You should expect hash functions to take in one arg (an int) and return a hash value.
key | The integer being hashed |
uint64_t hash_seeded | ( | const int * | key, |
uint64_t | seed | ||
) |
Built using MurmurHash3 A generalizable hash function that can be passed different seed inputs.
Will likely be good (but not great) since using only 64-bits of a 128-bit hash.
key | The integer being hashed |
seed | The uint64_t defining the seed of the hash. |
std::vector< int > readFile | ( | std::string | fname | ) |
Given a filename to a line-separated text file, create a vector of integers where each row in the text file is an entry in the vector.
You may assume the text file contains only numbers.
Your vector should match the exact structure of the input file – so the first row of the file should correspond to the 0th index of the vector.
filename | The filename of the text file. |
int split_string | ( | const std::string & | str1, |
char | sep, | ||
std::vector< std::string > & | fields | ||
) |
Given a string and character, split the string by the character and store in a vector A 'split' string treats the character as a breakpoint and creates a separate item in the output vector for each substring.
NOTE: The separator character is not included in the substrings.
The total number of substrings created (the length of fields) is returned
str1 | The string being split |
sep | The separator character |
fields | The string vector storing all substrings created by the split |
std::string trim_right | ( | const std::string & | str | ) |
Functions for the removal of whitespace to the left or right of a string (or both)
str | The string being processed |