https://github.com/erikgreasy/optimal-binary-search-tree
Dynamic programming OBST
https://github.com/erikgreasy/optimal-binary-search-tree
dynamic-programming optimal-binary-search-tree python
Last synced: about 2 months ago
JSON representation
Dynamic programming OBST
- Host: GitHub
- URL: https://github.com/erikgreasy/optimal-binary-search-tree
- Owner: erikgreasy
- Created: 2022-03-21T22:01:20.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-30T13:54:32.000Z (about 3 years ago)
- Last Synced: 2025-01-15T13:14:33.916Z (4 months ago)
- Topics: dynamic-programming, optimal-binary-search-tree, python
- Language: Python
- Homepage:
- Size: 460 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# OBST dynamic programming in python
Implementation of Optimal Binary Search Tree with the use of dynamic programming, written in Python.
## Main problem
The main focus is to implement OBST with use of dynamic programming (no recursion) based on the dictionary.txt file that contains list of English words with their frequency.Accepted words for the tree are words with frequency > 50k and we are taking the words in alphabetical order.
## Subproblems
### Number of comparisons
In the numOfComparisons.py there is implemented function to find the number of needed comparisons for finding the word. One comparison == one level of the tree.Number of comparisons for the root is equal to one.
## Running the program
After running the program, first the tree gets printed out to the console (first 10 levels). Then the program waits for user input to enter the word to find answer for Number of comparisons subproblem.To run the program, execute the following command:
```
python main.py
```