Section Four - Algorithms Flashcards
What are the three KEY techniques for computational thinking?
Decomposition
Abstraction
Algorithmic Thinking
What is Decomposition?
Breaking a complex problem down into smaller problems and solving each other individually
What is Abstraction?
Picking out the important bits of information from the problem, ignoring the specific details that don’t matter
What is Algorithmic Thinking?
A logical way of getting from the problem to the solution.
What are two ways you can write algorithms?
Psuedocode
Flow diagrams
What are Algorithms?
Sets of instructions for solving a problem
Fill in the Gaps:
Flow diagrams use (1) for different (2)
(1) Different Boxes
(2) Commands
What boxes are the BEGINNING and END of the algorithm put into?
Boxes with rounded corners
What is put in a parallelogram box?
Inputs/Outputs -
Anything that is put into or taken out of the algorithm
What boxes are INSTRUCTIONS, PROCESSES and CALCULATIONS put into?
Rectangular boxes
What is put in a diamond box?
Decisions -
such as ‘yes’ or ‘no’ questions
What is the purpose of ARROWS in flow diagrams?
Connect boxes and show the direction you should flow.
True or False?
Boxes in flow diagrams can only have ONE arrow coming in or going out?
False
Boxes in flow diagrams can have MULTIPLE arrows coming in or going out of them
What is the difference between BINARY searches and LINEAR searches?
A Binary Search looks for items in an Ordered List whereas a Linear Search can be used on an Unordered List.
Fill in the Gaps:
A linear search is much (1) than a binary search but not as (2).
(1) simpler
(2) efficient
What type of sort COMPARES pairs of items?
A Bubble Sort
What is a bubble sort algorithm used for?
To sort an unordered list of items
What are the advantages of a bubble sort algorithm?
It’s simple and can be easily implemented
It’s efficient to check if a list is already in order
Doesn’t use much memory
What are the disadvantages of a bubble sort algorithm?
It’s inefficient to sort a list
It doesn’t cope well with large lists of items
What is a merge sort algorithm an example of?
A divide-and-conquer algorithm
True or False?
A Merge Sort SPLITS the list apart and then MERGES it back together
True
What two facts does a merge sort algorithm take advantage of?
Small lists are easier to sort than larger lists
It’s easier to manage two ordered lists than two unordered lists
What are the advantages of a merge sort algorithm?
More efficient and quicker than bubble sort and insertion sort
Very consistent running time
What are the disadvantages of a merge sort algorithm?
Slower than other algorithms for small lists
Even if the list is already sorted it’ll go through the entire process
It uses more memory