I have 2 classes, NonEmptyTree and EmptyTree that implement the Tree interface. toString() method in NonEmptyTree class should return a string: key=>value key=>value key>value etc...
I do not know how to remove ...
My question is a tiny bit different from the results I found, and I haven't used Java in quite a while (novice), so I need some clarification.
Basically, I'm pretty sure my ...
I want to create a program that insert phone record to a binary search tree... The record accept name and phone number as input, so when i want to compare the data(key), which is the string type name, i have to compare it in alphabetical order. For example when i insert Kevin to the tree, Aaron will be the first node, ...
Hi I have binary search tree where I store words from a text file. When I'm done I get some statistics and I also want to traverse through the tree to get out all the elements . I use the preorder traverse method, but my method fails to cast the binary tree element to string. This is the result: OrdBokElem@1a1c887 - ...
Ahh, he said that it returned a String, which is why I said that. yes, since getInfo returns an object it should and does give him a ClassCastException. If getInfo returns a String, as he said it did, he would get a compile error (incompatible types) But there is no reason to cast whatever getInfo returns to be a TreeComparable..