aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
add method in a tree class
Question about TreeNode
how to set a node on expression tree
Help with expression Tree
Fail to create generic array?