CS 1337 Lecture Notes - Lecture 2: Selection Sort, Search Algorithm, Binary Search Algorithm

10 views5 pages

Document Summary

* the efficiency of a search algorithm is based on. * cost of efficiency of sorting, we generally are counting as the binary search is sooooo efficient, we often the number of swaps necessary to get the data sorted. The comparisons are typically not relevant find it an advantage to sort the data before searching especially if we"re going to do a lot of searching. //int main() often ascii value when sorting, we"re talking about some order, typically alphabetical and. * in class, we"re going to start by sorting numbers, using their value. * today we"re sorting integers, meaning we"re using the value. * bubble sort: compare adjacent values through the entire array: compare 17 & 23 proper order so leave alone for all adjacent pairs in array. 17 23 5 11 value: compare 23 & 5 not in proper order so swap them. 17 5 23 11: compare 23 & 11 not in proper order so swap them.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents