Describe the sorting pattern. Discuss the Selection sort routines in terms of this pattern
What will be an ideal response?
Sort array
1)Get split point and Split two parts
2)Sort first part(recursive)
3)Sort second part (recursive)
4)Join sorted parts.
Selection sort:
1)Split: two pieces, first with one element at the end,
the other part is one less than the size of the
array. This is the largest possible difference. Split
swaps smallest with begin, and returns begin +1 as
split point.
2)Recursively sort first part (there is only one
element, Display 20.2, line 17 makes sort do nothing)
3)Recursively sort second part.
4)Join is trivial
Postconditon on the Joining: The result is sorted.
The division into one piece of size 1 and a second of size n-1 causes the routine to run in quadratic, that is, O(N2) time.
You might also like to view...
Which control construct repeats a sequence of statements zero or more times?
a) while statement b) do-while statement c) for statement d) switch statement e) if-else statement
________ a measure of how two sets of data vary simultaneously
Fill in the blank(s) with correct word
When you first install or upgrade your computer to Windows 8 or 8.1, the operating system searches for hardware devices attached to your system and prompts the user to decide whether to load drivers required for these devices to function
Indicate whether the statement is true or false
Briefly describe the ROM Monitor mode.
What will be an ideal response?