Sorting Techniques

15/10/01


Click here to start


Table of Contents

Sorting Techniques

Insertion Sort

Example

How does it work?

Insertion Sort technique.

Insertion Sort Algorithm

Complexity

Selection Sort

Selection Sort Algorithm

The inner loop in the above algorithm finds the location of the next smallest element in the array (the location of the next smallest element in the array).

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort

Bubble Sort Algorithm

Quicksort

Quicksort

Quicksort

Implementation of Quicksort

Implementation of Quicksort()

Example

i stops at 4 (a[4] or V>= G), and loc at 8 (a[8] or D <= G). These values are then swapped.

i and loc continue to move until i > loc

Algorithm for partition(a,first,last,loc)

Recursive Quicksort Algorithm

i = first

Quicksort

Quicksort

The Partition

Recursive Quicksort Algorithm

Divide and Conquer

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Quicksort

Author: Computer Science Dept.