Unit 3 Lesson 9 and 11
Unit 3 Lesson 9 and 11
Unit 3 Lesson 9 and 11
Notes
Algorithms can be written in different ways and still accomplish the same tasks
Algorithms that appear similar can yield different side effects or results
Some conditional statements can be written as equivalent Boolean expressions
Some Boolean expressions can be written as equivalent conditional statements
Different algorithms can be developed or used to solve the same problem
Knowledge of existing algorithms can help in constructing new ones. Some existing algorithms include: Determining the maximum or minimum value of two or more numbers. Computing the sum or average of two or more numbers. Identifying if an integer is or is not evenly divisible by another integer. Determining a robot’s path through a maze.
Using existing correct algorithms as building blocks for constructing another algorithm has benefits such as reducing development time, reduce testing, and simplifying the identification of errors.
Vocab
Iteration: Repeating steps, or instructions over and over again. ( this could be also often called a loop )
Selection: is a decision or question. At some point in an algorithm there may need to be a question because the algorithm has reached a step where one or more options are available.
Algorithm: A process or set of rules to be followed in calculations or other problem solving operations, especially by a computer.
Hacks
Question 4
binary search tree for [1,2,3,4,6,9,11,69]
Question 5
In order to find the number 69 begin with the middle index and move on to the following numbers by dividing the first and final indexes by two. You continue until you reach number 69.
Question 6
Question 7
[“Market”, ”Ralphs”, “store”, “Target”, ”Walmart”]
put in alphabetical order
Question 8
Due to the fact that binary search automatically rules out half of the options with each iteration, it is much faster than sequential search. Since you begin at the middle index, you can either select the group that is higher or lower than the middle index.
Question 9
Binary Search Tree fro [64,36,16,11,9]
I would find the number 16 which would only take one check since it is the first middle index number
Reflection
These lessons were a bit challenging at first but with perserverance I was able to understand the concepts which allowed me to perform the hacks well. The presentation was great and I learned a lot from it.