ACO 101 Study Guide - Final Guide: Selection Sort, Sorting Algorithm, Linear Search

50 views4 pages
18 Mar 2015
School
Course
Professor

Document Summary

Suppose that you are given an array of elements and you want to put the elements in increasing or decreasing order. This can be useful for many different reasons, but here i will note just two. First, as we saw, we can search much faster in a sorted array than in an unsorted array (by doing binary search, instead of sequential search). Second, when we present data to customers, it can be very useful to show it in order (e. g. the names of students in a class, the bank transactions ordered by the date etc). Sorting is one of the most studied problems in computer science, and many different algorithms have been developed. Today we will discuss our rst sorting algorithm: selection sort. For examples, supposed we have the following array: We nd the max element (4) and its index, and we swap it in the last position.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related textbook solutions

Related Documents

Related Questions