next up previous
Next: Up: Previous:

Example: Sorting

*
Sorting is a common operation
*
Many sorting algorithms available, best choice depends on application

PROBLEM:
  • INPUT: Sequence of n numbers $\langle a_1, a_2, \ldots, a_n \rangle$
  • OUTPUT: Permutation (reordering) $\langle a_1', a_2', \ldots,
a_n' \rangle$ of the input sequence such that $a_1' \leq a_2' \leq
\ldots \leq a_n'$
INSTANCE:
$\langle 6, 4, 3, 7, 1, 4 \rangle \longrightarrow
\langle 1, 3, 4, 4, 6, 7 \rangle $


next up previous
Next: Up: Previous: