Create sets of integers with the following characteristics with array sizes of 1
ID: 3593242 • Letter: C
Question
Create sets of integers with the following characteristics with array sizes of 100,000, 500,000 and 1000,000
1. Set where no integer is repeated
2. Set where the range is low and the integers repeat
Compare the performances of the following sorting algorithms. You can either write the algorithms on your own or modify algorithms obtained from elsewhere. Create a table with the rows being the different algorithms and the columns being the inputs. Run each input 10 times and report the mean, and standard deviation for each run. You can also represent the results as a table. Write a short summary (about 1 paragraph) on your observations.
1. Quicksort
2. Quicksort until size of generated partitions is less than equal to 1000, 500, 100, 10 and then using insertion sort
3. Bucketsort
Explanation / Answer
typedef unsigned int u32; namespace WorkArea { static const u32 circularSize = 253250; u32 circular[circularSize] = { 0 }; // consumes 1013000 bytes static const u32 stageSize = 8000; u32 stage[stageSize]; // consumes 32000 bytes ... from subprocess import * import random sequence = [random.randint(0, 99999999) for i in xrange(1000000)] sorter = Popen('sort1mb.exe', stdin=PIPE, stdout=PIPE) for value in sequence: sorter.stdin.write('%08d ' % value) sorter.stdin.close() result = [int(line) for line in sorter.stdout] print('OK!' if result == sorted(sequence) else 'Error!')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.