Module tgg_05

Source

Functionsยง

array_reversal_0
Iteratively reverses the elements of an array in O(n) time
array_reversal_1
array_reversal_2
array_sum_0
array_sum_1
array_sum_2
array_sum_4
bin_search_0
Recursive implementation of a binary search in O(log n) time. Returns the index of the target within a given array, if present. Otherwise the function returns -1.
bin_search_0_wrapper
bin_search_1
Iterative reimplementation of a recursive binary search algorithm in O(log n) time. This algorithm takes a referenced vec and returns the index of the target, if it exists. Otherwise it returns -1 to indicate that the target is not in the vec.
disk_usage
factorial_0
Computs a n! up to 12 in O(n) time
factorial_2
Recursive implementation of a factorial calculator up to 12! in O(n) time
factorial_3
Iterative implementation of a factorial calculator up to 12! in O(n) time
factorial_4
Iterative implementation of a factorial calculator up to 12! in O(n) time
fib_0
powers_0
powers_1
powers_2
powers_3
tower_of_hanoi
A recursive implementation of the Tower of Hanoi solution that runs in O(2^n) time. This algorithm works by breaking the problem set into source, auxiliary, and destination pegs.