![]() |
Degree project help! Sorting an array
Right, We were set the task of designing a program for a fictional company "Loud music". I've come to a point in the code which i've never crossed before, i have to sort my array into ascending order. I've no idea how to sort an array, i've looked at numerous tutorials on numerous websites, and come to the conclusion bubble sort would be best? but can't apply it. This is the code:
:
Dim totalbr0(1 To 8) As SingleI'm not asking anyone to do my "schoolwork" for me, i'm hoping someone will be able to lay out what i'd have to do in lamens terms because im a novice programmer, and up to now the program was going quite well. Thankyou. |
Re: Degree project help! Sorting an array
|
Re: Degree project help! Sorting an array
Quote:
|
Re: Degree project help! Sorting an array
Quote:
|
Re: Degree project help! Sorting an array
So you only want us to do HALF your work for you? How about an explanation, instead. No frills for optimization.
Compare the first element to every other element in the array. If the compared element is smaller, swap 'em and continue. This will bubble the smallest item to the top. Move to the second element. Come it to every remaining element in the array. Swap if necessary. Rinse and repeat until done. For a descending sort, reverse the nature of the comparison. |
Re: Degree project help! Sorting an array
how is explaining the concept of a bubble sort and how it's done DOING half the work for me?
Thankyou for the explanation, it made more sense than most of the tutorials that i've looked at on the internet. I'll attempt to apply it. |
Re: Degree project help! Sorting an array
Writing pseudocode, as you asked, would be doing half the work for you. You'd only need a translator, not a thought process.
|
Re: Degree project help! Sorting an array
by writing pseudo code i literally just meant, could you write the standard form of a bubble sort
for example an if statement as if (condition, statement) i don't want someone to literally just write the code so i can copy it, that's of no use to me. I want to learn it, because without learning it i could be questioned on it and not know what i'm talking about. |
Re: Degree project help! Sorting an array
Quote:
Quote:
|
Re: Degree project help! Sorting an array
Managed to get it working, and now i've done it i actually understand a bubble sort.
Thanks dawei and null_ptr0 |
| All times are GMT -5. The time now is 3:36 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC