unit 10- algorithms Flashcards
What are the 4 ways algorithms are considered the same?
Algorithms that have the same outcome
Algorithms that use the same set of commands
Algorithms that store information the same way (use lists vs. variables)
Algorithms that are written using the same structure (AP Pseudocode vs. flowcharts vs. human language)
problem
a general description of a task that can (or cannot) be solved with an algorithm
Algorithm
a finite set of instructions that accomplish a task.
what are the three steps that can be used to write an algorithm?
sequencing, selection, and iteration
sequencing
putting steps in an order
Selection (Conditionals)
deciding which steps to do next
iteration (Loops)
Doing some steps over and over
Linear Search
Linear Search: a search algorithm which checks each element of a list, in order, until the desired value is found or all elements in the list have been checked.
binary search
a search algorithm that starts at the middle of a sorted set of numbers and removes half of the data; this process repeats until the desired value is found or all elements have been eliminated.
Worst-Case Scenario:
he least amount of steps to be sure you have solved the problem (in these examples, the worst case scenario is that there was no winning ticket)