d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help! > Java
Add Reply New Topic New Poll
Member
Posts: 22,003
Joined: Jun 30 2006
Gold: 2,527.00
Feb 1 2013 10:25am
So I have to make a dictionary in Java using binary trees, but I haven't figured out how I'm going to do this, if anyone could help that would be really appreciated!
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Feb 1 2013 06:20pm
not sure what your specific requirements are but i'll give it a shot.

i assume by dictionary you mean given a word, find its definitions. i assume you already have some sort of list/file/etc for all this data.

first store it all in memory in an array/arraylist/etc. then sort it. then build your BST from that sorted array

http://leetcode.com/2010/11/convert-sorted-array-into-balanced.html

you do this to build a height-balanced tree. if you just randomly add it, then you risk bad worst-cases (eg: linear search)
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll