CISC 121 Lecture Notes - Lecture 7: Linear Search, Bubble Sort, Selection Sort

52 views1 pages
wunch and 39345 others unlocked
CISC 121 Full Course Notes
35
CISC 121 Full Course Notes
Verified Note
35 documents

Document Summary

Return the index of the value in the list (or none if element not present) Number of comparisons for sequential search is proporional to the size of the list. Binary search: list must be in order basic algorithm: If value is bigger, repeat with larger half of list. If value is smaller, repeat with smaller half of list. Logarithmic algorithm (this is why its so much faster for bigger list) Bubble sort: simple and easy to program but slow. Basically search to find smallest element and put it in the smallest spot. Worst case: o(n^2) - can happen when the list is sorted or almost sorted already.

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents