01:198:111 Lecture Notes - Lecture 1: Vending Machine

49 views2 pages
cyansea-lion159 and 56 others unlocked
01:198:111 Full Course Notes
47
01:198:111 Full Course Notes
Verified Note
47 documents

Document Summary

Cs(cid:638)(cid:638)(cid:638) - week (cid:638) notes (cid:639). (cid:638) algorith(cid:268)ic thi(cid:269)ki(cid:269)g. Algo(cid:304)ith(cid:268) fo(cid:304) fi(cid:269)di(cid:269)g a (cid:269)a(cid:268)e i(cid:269) a so(cid:304)ted list. Co(cid:269)ti(cid:269)ue di(cid:341)idi(cid:269)g f(cid:304)o(cid:268) the (cid:268)iddle of list u(cid:269)til ta(cid:304)get is (cid:304)eached. If coi(cid:269) . (cid:639)(cid:642), accept the coi(cid:269) i(cid:269)to the (cid:268)achi(cid:269)e a(cid:269)d co(cid:269)ti(cid:269)ue to step (cid:640). (cid:638). (cid:639). Ewse coi(cid:269) is (cid:269)ot . (cid:639)(cid:642), eject the coi(cid:269) f(cid:304)o(cid:268) the (cid:268)achi(cid:269)e a(cid:269)d go to step (cid:638) (cid:688)(cid:304)ead a(cid:269)othe(cid:304) coi(cid:269)(cid:689). If coi(cid:269) . (cid:639)(cid:642), accept the coi(cid:269) i(cid:269)to the (cid:268)achi(cid:269)e a(cid:269)d co(cid:269)ti(cid:269)ue to step (cid:641). (cid:638). (cid:639). Ewse coi(cid:269) is (cid:269)ot . (cid:639)(cid:642), eject the coi(cid:269) f(cid:304)o(cid:268) the (cid:268)achi(cid:269)e a(cid:269)d go back to step (cid:640) (cid:688)(cid:304)ead a(cid:269)othe(cid:304) coi(cid:269)(cid:689). (cid:640). Allo(cid:342) use(cid:304) to i(cid:269)put (cid:269)u(cid:268)be(cid:304) fo(cid:304) s(cid:269)ack/d(cid:304)i(cid:269)k (cid:641). Fi(cid:269)di(cid:269)g the tallest perso(cid:269) fro(cid:268) a list of people (cid:638). Divide the list (cid:688)size (cid:269)(cid:689) i(cid:269)to pai(cid:304)s (cid:639). Compa2e each pai(cid:304) a(cid:269)d fi(cid:269)d the tallest to c(cid:304)eate a (cid:269)e(cid:342) list (cid:688)size (cid:269)/(cid:639)(cid:689). (cid:640). 2epeat step (cid:638) u(cid:269)til size of the list is (cid:638).

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