Iteration through tree

This is a discussion on Iteration through tree within the Eiffel forums in Programming Languages category; 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...

Go Back   Application Development Forum > Programming Languages > Eiffel

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-28-2007, 01:40 PM
=?ISO-8859-1?Q?Roman_T=F6ngi?=
Guest
 
Default Iteration through tree

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
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:42 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.