Algorithms Flashcards
What is decomposition?
Breaking a complex problem down into smaller problems and solving each one individually
What is abstraction?
Picking out the important parts 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 algorithms?
Sets of instructions for solving a problem
What are the advantages of pseudo-code?
1) quick to write
2) can be easily converted into any programming language
How can algorithms be shown?
1) pseudo-code
2) flowcharts
What box is used to show the beginning and the end of an algorithm?
Boxes with rounded corners
What box is used to show anything that’s put into or taken out of the algorithm?
Parallelogram boxes
What box is used to show general instructions, processes and calculations?
Rectangular boxes
What box is used to show decisions, often a ‘yes’ or ‘no’ question?
Diamond boxes
What are subroutine boxes references to?
Other flowcharts
What do the arrows in flowcharts show?
The direction you should follow
What can flowcharts show?
1) sequences
2) selections
3) iterations
What type of lists are binary searches used for?
Ordered lists
How does a binary search algorithm work?
1) find the middle item in the ordered list
2) if this is the item you’re looking for, then stop the search - you’ve found it
3) if not, compare the item you’re looking for to the middle item. If it comes before the middle item, get rid of the second half of the list. If it comes after the middle item, get rid of the first half of the list
4) you’ll be left with a list that is half the size of the original list. Repeat steps 1 to 3 on the smaller list to get an even smaller one. Keep going until you find the item you’re looking for