Onoam / WAVLTree

Java implementation of WAVL Trees for Data Structures course
0 stars 0 forks source link

Wrote select, search, treeSearch, treePosition, delete, insert, treeInsert, remove, removeLeaf, side #29

Closed eytan-c closed 5 years ago

eytan-c commented 5 years ago

Both are similar functions, but with different uses. 1) Select, finds the node in the tree, and returns an external node if the node doesn't exist. 2) findInsertParent - finds the node underwhich to insert a new node. The only issue that might arise in insert is if we want to insert a node with a key that is already in the tree. If we could return a tuple in Java that would solve it (and we can just have 1 function) but I don't know if that is possible.

Onoam commented 5 years ago

According to the project specifications, we don't need to insert a node if one already exists with its key. We just return -1 and do nothing.

eytan-c commented 5 years ago

@Onoam Let's decide on what functions to use for the finding.

eytan-c commented 5 years ago

Lot's of functions to go over. Some logic: For the actual inserting and deleting, wrote private functions that do the work (for readability). Also added some helper functions for different cases of delete. Regarding the search etc, I decided to go with what was in the slides, but let's discuss what to keep out of all the options. #5 #7 #6

eytan-c commented 5 years ago

also, I assumed the signature for rebalance would be private int rebalance(WAVLNode node)

Onoam commented 5 years ago

This tons of code! I can't actually read all of it in detail, but from what I read it looks good, I'm just gonna assume that it all is. ;)