Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Eiffel > Iteration throu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 893 of 909
Post > Topic >>

Iteration through tree

by =?ISO-8859-1?Q?Roman_T=F6ngi?= <roman.toengi@[EMAIL PROTECTED] > Oct 28, 2007 at 06:40 PM

How can I use the iteration mechanism to iterate through a tree?
Is CURSOR_TREE_ITERATOR the right class?
The following does not compile because iterator expects the type
CURSOR_TREE [BINARY_SEARCH_TREE [INTEGER_32]].

class
   APPLICATION

create
   make

feature -- Initialization
   make is
       -- Run application.
     local
       tree: BINARY_SEARCH_TREE [INTEGER]
       iterator: CURSOR_TREE_ITERATOR BINARY_SEARCH_TREE [INTEGER]]
     do
       create tree.make (500)
       tree.put (400)
       tree.put (600)
       create iterator
       iterator.set (tree)
     end
end -- class APPLICATION


There must be a simple solution without requiring the client programmer 
to build his own class inheriting from the deferred class CURSOR_TREE, 
isn't it?



Thx




 1 Posts in Topic:
Iteration through tree
=?ISO-8859-1?Q?Roman_T=F6  2007-10-28 18:40:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 3:23:32 CDT 2008.