Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 probelm with this code!(c#)

views
     
TSming1
post Feb 17 2006, 04:35 PM, updated 20y ago

Getting Started
**
Junior Member
252 posts

Joined: Jan 2005
This is a code for sorting the ascending order.Altough i had this code, but i don't really know the concept for this code and how does this code work actually......

for (int count = findings.Length - 1; count > 0; count--)
{
for (int countInner = 0; countInner < count; countInner++)
{
if (findings[countInner + 1] <= findings[countInner])
{
temp = findings[countInner];
findings[countInner] = findings[countInner +1];
findings[countInner +1] = temp;
}
}
}
for (int count = 0; count < findings.Length; count++)
{
Console.Write("{0}\t", findings[count]);
}

Can anyone explain to me????
TSming1
post Feb 17 2006, 05:27 PM

Getting Started
**
Junior Member
252 posts

Joined: Jan 2005
yes it is a bubble sort....i do not have any text book,that's why i'm here finding for assistance....

TSming1
post Feb 17 2006, 05:30 PM

Getting Started
**
Junior Member
252 posts

Joined: Jan 2005
besides using this way, is there another easiest way for me to sort number in ascending manner???

 

Change to:
| Lo-Fi Version
0.0132sec    0.29    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 07:47 AM