1. Using C/C++, define two integer arrays; each has 30 integers within [0, 999]. Use loop
and rand() to assign random integers to the arrays; then implement Selection and
Insertion sort algorithms to sort the two arrays in ascending order, respectively (i.e.
using selection to sort the 1
st
, and insertion to sort the 2
nd
. For each array, print all
array elements after sorting to verify the results.
2. Given a set of integer numbers as int A[ ] = { 12, 6, 51, 4, 3, 7, 19, 8, 0, 21}, please
write down the divide and conquer procedure of quick sort (step by step), include all
left and right positions adjustment, and overwriting.
3. Using C/C++, define an integer array with 100 integers and assign random numbers,
implement Quick Sort algorithm to sort and output the result.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *