General

Chat

Computer Science Help

Can someone explain to me how elements are added in a treeset?

December 5, 2013

3 Comments • Newest first

Neuro

i got it, thanks for your help guys

Reply December 5, 2013
MarshMallows

It's just a series of nodes that branch out. What the first poster did was correct.
It'll be harder if you wanted a sort binary tree though, those can be difficult to code, but have O(n) time

Reply December 5, 2013
Neuro

[quote=Harlequinist]public static void main(String args[]) {
TreeSet blah = new TreeSet();
blah.add("I'm" );
blah.add("so" );
blah.add("awesome" );
System.out.println(blah);
}[/quote]

what would the data structure look like if i were to draw a diagram?

Reply December 5, 2013