Alien can Computer Science
Index Sorting Searching

Sorting

Quicksort

Process

  1. Pick a pivot point. Random will do.
  2. Seperate the group into two groups, in which one is 'larger' than the pivot point and one is 'smaller' than the pivot point.
  3. Send each of these groups to a new copy of the algorithm. These will repeat steps 1 through 3 with their respective groups.
  4. After all items are isolated, they will return to the original algorithm sorted.

Pros

Cons

Image taken from: NCZ Online

Mergesort

Image taken from: Wikipedia

Process:

  1. Divide the group into 2 even groups.
  2. Send both of these new groups to new copies of algorithm.
  3. Each of these algorithms will repeat steps 1 and 2 until each item has been isolated.
  4. As the items return, the algorithms will sort their group before sending to the previous 'parent' algorithm.

Pros

Requires less cpu

Cons

Takes longer than Quicksort