C S 313E Lecture Notes - Lecture 5: Binary Search Algorithm, Selection Sort, Insertion Sort

66 views2 pages
30 May 2019
School
Course
Professor

Document Summary

Go as far as you can and backtrack only where necessary. Not guaranteed to find the best solution. Represent a maze using an m x n 2d list containing 0s and 1s. Exit: any 0 located in row 0, row m, column 0, or column n. Starting position: pair of indices in the m x n list. State: representation of where you currently are in solving the problem. History (path to get to this point) Sequential search: moving from item to item, following the underlying sequential ordering until finding the item or running out of items. Uses ordered nature of the list to eliminate half of the remaining items. O(k) operation where k is the size of the slice. File systems use sort all the time. Starting from the left, compare adjacent elements. If they"re in the wrong order, switch them. Move to the next pair and repeat until getting to the end.

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