Algorithms

Moderators: None (Apply to moderate this forum)
Number of threads: 402
Number of posts: 786

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
complexity of algo Posted by omveeromveer on 26 Nov 2004 at 11:51 PM
Hi,
Can anyone tell about concept of complexity. As I am beginner with complexity . Please explain with a sorting algo.
Regards
Omveer
Report
Re: complexity of algo Posted by DrMarten on 7 Apr 2005 at 8:52 PM
: Hi,
: Can anyone tell about concept of complexity. As I am beginner with complexity . Please explain with a sorting algo.
: Regards
: Omveer
:

Here goes:->

If you had a long list of random numbers like 34 12 56 7689 693 20 347 2 85 93683 etc or whatever and you wanted to sort them you could do this one of a few ways . In order by value ascending or descending.

As 12 is the lowest number you would have this as the 1st nuber in an ascending list.
93683 would be the highest or 1st number out in a descending list.

If you sorted by string method all the numbers starting with a 1 then a 2 etc would come out regardless of how long the number is.

You would look for the lowest number and the highest number and do a loop between them.

See the following articles on "BUBBLE SORT" routines where the next lowest ( or highest item ) "floats like a bubble through a list" to sort a list out>>>

http://www.google.co.uk/search?hl=en&ie=ISO-8859-1&q=bubble+sort&meta=

Hope this helps.



Report
Re: complexity of algo Posted by jayaram_b on 24 Jun 2005 at 8:20 PM
: Hi,
: Can anyone tell about concept of complexity. As I am beginner with complexity . Please explain with a sorting algo.
: Regards
: Omveer
:
bubble sort algorithm has the order of n^2 where n is the number of numbers.

i.e
for(i=0;i<n;i++)\\continues n times
{
for(j=i+1;j<n;j++)\\continues n times
{
//compare and swap
}
}

therefore totally n*n times.

hope u would be clear now.

if not forward it here or contact me personally at jayaram_b05@yahoo.com




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.