Cori Jacoby, Alex King
This repository holds all code from our project focused on optimal binary search trees.
Implementations:
BSTTree.py
: basic binary search tree implementation used by below algorithmsoptimal_bst_knuth.py
: implementation of Knuth's O(n^2) dynamic programming algorithm for optimal binary search treesoptimal_bst_knuth_n3.py
: un-optimized version of above that runs in O(n^3) timeapproximate_bst_mehlhorn.py
: implementation of Mehlhorn's O(n*log(n)) approximation algorithmhighest_prob_root.py
: implementation of Knuth's poor "Rule 1" approximation algorithm (Also O(n*log(n)))AVLTree.py
: AVL tree implementation
Testing:
generate_test.py
: helper functions related to generating test searches upon frequency distributionsbenchmarks.py
: benchmarking program to compare runtimes and expected depths of different treesbsttests.py
: basic functional tests for binary search tree implementationtest_data/
: directory containing a few public domain English language books for building frequency distributions
Analysis:
final_report.pdf
: A thorough report and analysis of all results