| Author |
Trees with arbitrary node pointers
|
Rocky Summers
Ranch Hand
Joined: Nov 07, 2003
Posts: 66
|
|
Hello guys.. how do i make a node class of a tree that has arbitrary pointers (unbounded). unlike the binary tree, where it only has two pointers (left and right).. cuz i'm making a spanning tree and it's driving me nuts on how to make the arbitrary pointers. thanks.
|
 |
Jaap van Hengstum
Greenhorn
Joined: Jul 24, 2003
Posts: 24
|
|
You mean something like this?
|
 |
Rocky Summers
Ranch Hand
Joined: Nov 07, 2003
Posts: 66
|
|
thank you! i'll try that out!
|
 |
Rocky Summers
Ranch Hand
Joined: Nov 07, 2003
Posts: 66
|
|
hello (again) i was just wondering what this meant: i just want to understand..
|
 |
Rocky Summers
Ranch Hand
Joined: Nov 07, 2003
Posts: 66
|
|
hi, i tried compiling the code you gave me at home and it worked. but when i tried to compile with the computers here in school, it didnt work.. here's the error: Node.java:5: incompatible types found : java.util.ArrayList required: List private List nodeList = new ArrayList();
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
"Web": please take a moment to review our display name policy and then edit your display name to something less fictitious-sounding than "Web". Thanks. As for your question: it looks like there's another class somewhere called List, which is confusing the compiler. You want java.util.List, not a "List" in the default package (which is what your error message indicates). You can either (a) rename the other List class, (b) delete it entirely, or (c) refer to java.util.List by its fully qualified name when that's the one you mean. [ November 08, 2003: Message edited by: Jim Yingst ]
|
"I'm not back." - Bill Harding, Twister
|
 |
Rocky Summers
Ranch Hand
Joined: Nov 07, 2003
Posts: 66
|
|
oh shoot that's right!!! i have a List.java in my directory! ha... ha.... i feel so stupid. thanks! ok ill change my name.
|
 |
Rocky Summers
Ranch Hand
Joined: Nov 07, 2003
Posts: 66
|
|
how would i go about adding more nodes to the tree? this is my code for the insert: and this is what i have in my node class:
|
 |
 |
|
|
subject: Trees with arbitrary node pointers
|
|
|