CSCI 1105 Lecture Notes - Lecture 17: Linear Search

104 views3 pages
Verified Note

Document Summary

Iterate as count controlled loop which iterated over a range of integer values: for any container, such as a list or a string (anything that contains or stores elements. ) Initialisation: conditions, updates (check if the condition is still true) Off by one errors: common errors in loops, think through simple test cases to avoid this type of error, quickest way to test this is to test a boundary of your loops. Sentinel values: end a data set but are not a part of the data set. Boolean variables: you can use boolean variables to control loops, common in while loops, set variable to true before entering the loop, set variable to false to leave the loop, boolean variables are inherently equal to true. Loops can be used in conjunction with many string processing tasks. In a simulation, you use the computer to simulate an activity: you can introduce randomness by calling the random number generator. rand, and randint.

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