COEN 179 Lecture Notes - Lecture 8: Brute-Force Search, Array Data Structure, Maltese Lira

7 views13 pages

Document Summary

State expected input 1 output e. g unordered search. Input "s array a [ o . h -it a target x output "s return true if x is an element ofa otherwise false e -9. Input "s away a co . output "s smallest value in a . h -17 , h z1. 1st design strategy is exhaustive search (cid:8869) it guarantees to produce a concert. Most often , it is not efficient . Exhaustive search applies to problems that ask for an object w/ some desired property . Enumerate all candidates (with a for loop) x protege. Test each x for desired property explicitly . Ei unordered search ( a co . h i] , Oji c n sitt i ) "ll enumerate all candidly if ca ci ) = =d atest for desired property returntrue return false; Analysis : un) = hot comparisons iz 0 ( ch ) = 7744 ) = n - i - ot th.

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