sort - Sorting Selection Sort Sorting and searching are...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Sorting Sorting and searching are among the most common programming processes. We want to keep information in a sensible order. - alphabetical order - ascending/descending order - order according to names, ids, years, departments etc. The aim of sorting algorithms is to put unordered information in an ordered form. There are many sorting algorithms, such as: - Selection Sort - Bubble Sort - Insertion Sort - Merge Sort - Quick Sort The first three are the foundations for faster and more efficient algorithms. 2 Selection Sort & The list is divided into two sublists, sorted and unsorted , which are divided by an imaginary wall. & We find the smallest element from the unsorted sublist and swap it with the element at the beginning of the unsorted data. & After each selection and swapping, the imaginary wall between the two sublists move one element ahead, increasing the number of sorted elements and decreasing the number of unsorted ones. & Each time we move one element from the unsorted sublist to the sorted sublist, we say that we have completed a sort pass.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 06/12/2011.

Page1 / 6

sort - Sorting Selection Sort Sorting and searching are...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online