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 > Re: sort array
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 888 of 917
Post > Topic >>

Re: sort array

by Friedrich Dominicus <just-for-news-frido@[EMAIL PROTECTED] Oct 16, 2007 at 08:00 AM

Roman Töngi <roman.toengi@[EMAIL PROTECTED]
> 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.




 2 Posts in Topic:
sort array
=?ISO-8859-1?Q?Roman_T=F6  2007-10-15 18:26:10 
Re: sort array
Friedrich Dominicus <j  2007-10-16 08:00:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat May 17 8:40:51 CDT 2008.