This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Breadth-first traversal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Breadth-first traversal" Watch "Breadth-first traversal" New topic
Author

Breadth-first traversal

Mark Rem
Greenhorn

Joined: Dec 11, 2004
Posts: 13
I'm trying to implement a Breadth-first traversal in the application class use a queue and a binarysearchtree..I'm getting an error

public void breadthFirst( TreeNode tNode)
{
Queue q = new Queue( );
if( q.isEmpty() )
{
q.enqueue( this );
}

while( !q.isEmpty() )
{

}

}

E:\ICS\ICS 211 Projects (Fall 04)\Final Exam\211final_src\FinalDataTypesTest.java:11: cannot resolve symbol
symbol : class TreeNode
location: class FinalDataTypesTest
public void breadthFirst( TreeNode tNode)
^
1 error
Amirthalingam Prasanna
Ranch Hand

Joined: Jan 08, 2004
Posts: 107
Hi,
Its because your method cannot find the class TreeNode.
If you are using the TreeNode from the swing library you need to import javax.swing.tree.TreeNode to make it work


Prasanna <br />[SCJA Beta, SCJP 1.4, SCJP 5.0 Beta]<br />[MCSD, MCPD, MCT, MVP]<br /><a href="http://www.prasanna.ws" target="_blank" rel="nofollow">My Blog</a>
Mark Rem
Greenhorn

Joined: Dec 11, 2004
Posts: 13
what about if my TreeNode class is in my BinarySearchTree class?
How can pass it as a parameter to the breadthFirst()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Breadth-first traversal
 
Similar Threads
Fail to create generic array?
Help with expression Tree
Question about TreeNode
add method in a tree class
how to set a node on expression tree