Question: implement a function for dictionary class using binary search tree that has the word and its meaning, i have the BST code and nodes written

implement a function for dictionary class using binary search tree that has the word and its meaning, i have the BST code and nodes written i need the functions which are:
1)insert: that takes the word and meaning as strings, if the word is already in the dictionary the meaning is replaced with the new one. if tge word given is an empty string it does nothing. worst case running time is O(height).
2)shortest_word: that returns the shortest word in the dictionary and returns an empty string if the dictionary is empty. worst case running time is O(1).
3) longest_word: that returns the longest word in the dictionary and an empty string if empty. worst case running time is O(1).
4)clean: that removes every word whose meaning is an empty string. worst case running time is O(n).
5)words_beginning_with: that takes a character and counts and returns the number of word that begin with the given character. worst case running time is O(height+k).
we can add new data members to the class dictionary and new private functions if needed.
thank you in advance, please submit the most efficient work it would mean a lot, thanks again!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!