Im tring an experiment that will generate 7000 integer random numbers and save them in an array. Then I need to copy these 7000 values into a second array, so that I have two identical integer arrays.
In a function, I want to sort the first array with an un-optimized bubble sort.
In a second function, I want to sort the second array with an optimized bubble sort.
So in the main, I would like to print out the time each sort routine took to execute and print out a message determining which sort routine was faster.
Any Ideas, I made this one up for fun to also learn how to do arrays and counts.
Any help would be appreciated.....
New Experiment Messin With
Started by joebenjamin, Sep 17 2007 12:20 AM
3 replies to this topic
#1
Posted 17 September 2007 - 12:20 AM
|
|
|
#2
Posted 17 September 2007 - 04:17 AM
time.h can get you the start and end times of the sort. stdlib.h has a rand() function for generating integers that you can seed with the current time.
#3
Posted 17 September 2007 - 06:22 AM
This post will help you get random numbers:
- http://forum.codecal....html#post23362
Bubble sort should be fairly easy to implement. This will probably help you.
- http://forum.codecal....html#post23362
Bubble sort should be fairly easy to implement. This will probably help you.
#4
Posted 10 October 2007 - 11:20 PM
Thanks a lot Kkelly it's working. I tried it 10 minutes ago. Thanks a lot Void that also gave me a little help for understanding random numbers and counts.
Cheers.
Cheers.


Sign In
Create Account

Back to top









