| | |
How to traverse
![]() |
•
•
Join Date: Oct 2008
Posts: 37
Reputation:
Solved Threads: 0
Java Syntax (Toggle Plain Text)
public String preOrder(int nodeIndex) { if(nodeIndex>nodeArray.length) { return(null); } else if(nodeArray[nodeIndex].isLeaf(nodeArray.length-1)) { return(nodeArray[nodeIndex].toString()); } else { return(nodeArray[nodeIndex].toString()+" "+preOrder(nodeArray[nodeIndex].leftChild)+" "+preOrder(nodeArray[nodeIndex].rightChild)); }
I am really stack with it. I dont how to output the numbers i input. If i input: 1 2 3 4 5 6, it only outputs 1 2 3. Please help me, I really need your help. Thank you in advance. We have to use arrays.
}
![]() |
Similar Threads
- Need to traverse and update a XML file (C++)
- Text file traverse problem (C++)
- How do I traverse tabbedpanes programmatically? (Java)
- traverse function doubly linked list (C)
- How to traverse an array?? What am I doing wrong? (C++)
- Tab control on hidden input fields (HTML and CSS)
Other Threads in the Java Forum
- Previous Thread: Java question...
- Next Thread: JAVA SQL matrix
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working





