sort array

This is a discussion on sort array within the Eiffel forums in Programming Languages category; How can I sort an array or a linked_list? These classes do not provide sorting-routines. Thx...

Go Back   Application Development Forum > Programming Languages > Eiffel

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-15-2007, 12:26 PM
=?ISO-8859-1?Q?Roman_T=F6ngi?=
Guest
 
Default sort array

How can I sort an array or a linked_list?
These classes do not provide sorting-routines.

Thx
Reply With Quote
  #2  
Old 10-16-2007, 02:00 AM
Friedrich Dominicus
Guest
 
Default Re: sort array

Roman Töngi <roman.toengi@hispeed.ch> writes:

> How can I sort an array or a linked_list?
> These classes do not provide sorting-routines.


Something along this lines will do:

class
APPLICATION



create
make

feature -- Initialization

make is
-- Creation procedure.
local
comparator : KL_COMPARABLE_COMPARATOR[INTEGER];
my_sorter : DS_ARRAY_QUICK_SORTER[INTEGER];
some_array: ARRAY[INTEGER];
do
create comparator.make;
create my_sorter.make(comparator);
some_array := <<1,2,-1,2,-10,-100>>;
print(some_array);
my_sorter.sort(some_array);
print(some_array);

end


end -- class APPLICATION


Regards
Friedrich


--
Please remove just-for-news- to reply via e-mail.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:51 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.