Section 4: Algorithms Flashcards
Define Computational Thinking.
The steps a computer takes to solve a complex problem.
What are the three key techniques for Computational Thinking?
Decomposition, Abstraction and Algorithmic thinking.
Define Decomposition, (computational thinking)
Breaking down a complex problem into smaller problems and solving each one individually.
Define Abstraction, (computational thinking)
Picking out important information from the problem, ignoring the specific details that don’t matter.
Define Algorithmic Thinking, (computational thinking)
A logical way of getting from the problem to the solution.
Define Algorithm.
Algorithms are just sets of instructions for solving a problem.
Name the three main types of flow diagrams.
Sequences, Selection and Iteration
Describe a Sequence flow diagram.
There is only one way through the diagram, from start to end.
Describe a Selection flow diagram.
There are multiple ways through the flow diagram from start to end.
Describe a Iteration flow diagram.
A flow diagram that contains a loop, that allows you to repeat a task.
What are the two main search algorithms?
Binary Search and Linear Search.
State the method of a Binary Search.
1) Find the middle item of the ORDERED list
2) If this is the item you’re looking for, then stop the search - you’ve found it.
3) If not found, compare the item you’re looking for with the middle item, if the middle item is larger then get rid of the second half of the list, if the middle item is smaller then get rid of the first half of the list.
4) Repeat steps 1-3 on this new smaller list until you find the desired item.
State the method of a Linear Search.
1) Look at the first item in the UNORDERED list
2) If this is the item you’re looking for, then stop the search - you’ve found it.
3) If not, then look at the next item in the list.
4) Repeat steps 2-3 until you find the item that you’re looking for or you’ve checked every item.
Advantages of Binary Search.
1) Binary searches are much more efficient
2) In general, binary searches take less steps to find the item you are looking for, which makes it more suitable for large lists of items.
Advantages of Linear Search
1) Linear searches are more simpler
2) Linear searches can be used on any type of list , it doesn’t have to be ordered.
3) Could be better for smaller lists