Author |
Message |
cool dude
|
Posted: Mon Jan 30, 2006 12:52 pm Post subject: Bubble sort |
|
|
i'm trying to learn bubble sort and i can't get it. can somebody explain to me or show me a sample prog that i could learn from. AND NO i'm not asking u to do my homework besides i don't have any homework i just wanna learn bubble sort. if u post a sample prog please explain it with comments. thanks |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Mon Jan 30, 2006 2:34 pm Post subject: (No subject) |
|
|
zylum has posted a number of sorting examples for Turing. Though if you're just trying to figure out the logic behind the algorythm, then language syntax should be irrelavent.
In bubble sort you essensially take elements one by one and compare them to all others, swaping a larger number to the end of the list, effectivly "bubbling" it up. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
cool dude
|
Posted: Mon Jan 30, 2006 6:54 pm Post subject: (No subject) |
|
|
thats a good tutorial thanks for pointing it out. and thanks to zylum for making it. the only problem i'm having now is i'm trying to get the numbers to sort from a file so i'm sorting it all correctly, but i wanna display it in a list box. i don't know how to display the sorted numbers in the list box. i'm trying somethin like this:
code: |
lstSort.AddItem nums(i)
|
this however doesn't sort everythin. how would i display it in the list box? |
|
|
|
|
|
Tony
|
Posted: Mon Jan 30, 2006 9:49 pm Post subject: (No subject) |
|
|
I would guess that you'd need to sort your nums() array before adding elements to the list box. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
cool dude
|
Posted: Mon Jan 30, 2006 11:53 pm Post subject: (No subject) |
|
|
how does bubble sort and selection sort differ? |
|
|
|
|
|
person
|
|
|
|
|
cool dude
|
Posted: Tue Jan 31, 2006 7:18 pm Post subject: (No subject) |
|
|
thanks for the help i already figured it out. |
|
|
|
|
|
|