Computer Science Canada Sorting algorithm |
Author: | Mikez [ Fri Dec 13, 2002 12:32 pm ] |
Post subject: | Sorting algorithm |
plz tell or show me an advanced form of Sorting algorithms (not bubble) for me to use. include code if possible. ps thanks in advance |
Author: | FizixMan [ Fri Dec 13, 2002 1:09 pm ] |
Post subject: | |
Helps if we knew what we were sorting, and how they are to be sorted. |
Author: | Mikez [ Fri Dec 13, 2002 7:39 pm ] |
Post subject: | Sorting |
I will be sorting the scores of players in a game eg. mike's score is 100 adam's score is 11 etc they need to be sorted from highest to lowest or vice verse |
Author: | Mikez [ Fri Dec 13, 2002 7:42 pm ] |
Post subject: | |
also the more advanced the better but if u can please give a couple. (if you have the time) thanx u guys are a HUGE help. keep up the good work |
Author: | FizixMan [ Fri Dec 13, 2002 10:55 pm ] | ||
Post subject: | |||
Well... I'm assuming you'll be inputing a number of scores.. I'm also assuming you know how man scores to be inputed. Now, I could write code for you to pretty much make a dynamic sized array... but that would probably be more than your teacher or yourself are really capable of (so I'm not going to make it that advanced for you) in fact, I'm going to help out with the basics, you can get that working... and if you have any ideas on how to make it more advanced, well ask and we'll see if we can help you... but this deal with people just asking for the complete source code to class homework and projects is pretty lame... and believe me... all offense intended j/k Again... keep asking for the code if you want, I don't intend to just write it for you (even though I always do write the program to make sure what I'm giving you works... so easy to just copy paste the code... but it's so much better that you all learn how to code it from scratch) okay, well... if you know how many scores are being put in, just declare an array of integers with that many elements. Then you'll want a "for loop" to go through the scores and sort them... also, I'm assuming you'll just want these outputted to the screen and not restored in an array... if you want them stored in an array, just change the part where it prints to the screen with a line that saves it to an array element.
I hope you understand that |