Functions | |
void | insert_n_linear_height_tree (size_t n) |
Function to time n inserts on a linear structured tree (worst case) More... | |
void | insert_n_logarithmic_height_tree (size_t n) |
Function to time n inserts on a complete binary tree (best case) More... | |
void | insert_n_random (size_t n) |
Function to time n inserts of random data (avg case) More... | |
template<typename Func > | |
void | time_function (Func f, size_t max_size, string name) |
Control timing of a single function. More... | |
int | main () |
Main function to time all your functions. More... | |
void insert_n_linear_height_tree | ( | size_t | n | ) |
Function to time n inserts on a linear structured tree (worst case)
n | Input size |
void insert_n_logarithmic_height_tree | ( | size_t | n | ) |
Function to time n inserts on a complete binary tree (best case)
n | Input size |
void insert_n_random | ( | size_t | n | ) |
Function to time n inserts of random data (avg case)
n | Input size |
void time_function | ( | Func | f, |
size_t | max_size, | ||
string | name | ||
) |
Control timing of a single function.
Func | Function type |
f | Function taking a single size_t parameter |
max_size | Maximum size of test. For linear - 2^23 is good, for quadrati - 2^18 is probably good enough, but its up to you. |
name | Name of function for nice output |
Essentially this function outputs timings for powers of 2 from 2 to max_size. For each timing it repeats the test at least 10 times to ensure a good average time.
int main | ( | ) |
Main function to time all your functions.