2.1 Algorithims
No description yet. This curated deck is ready for daily study.
Card preview (18)
What is an algorithm?
• Set of instructions
What is decomposition?
• Breaking up data • Smaller more manageable parts
What is abstraction?
• Ignoring parts of data • Faster outcome
What does a rounded rectangle represent in flowcharts?
• Start / Stop
What does a rectangle represent in flowcharts?
• Process
What does a diamond represent in flowcharts?
• Decision
What does a diamond represent in flowcharts?
• Decision
What does a parallelogram represent in flowcharts?
• Input / Output
What does a rectangle with two lines inside represent?
• Subroutine
What is a variable?
• A location in memory • Can be changed while the program is running
What are the steps for a bubble sort?
• Start at the beginning of the values • Compare the first and second values : if not in order, swap • Continue through the list • Repeat through the list until in order • Do one last pass to ensure order ** One comparison is one pass
What are the steps for merge sort?
• Split all elements into individual lists • Compare the first elements of the lists • Place the smallest in a new list • Continue to compare first elements of the lists • Repeat until individual lists have merged
What are the steps for an insertion sort?
• The item is taken and placed in the correct position • Continue through • Repeat until sorted
When is a bubble sort the better choice?
• Shorter list • Mostly in order
When is a insertion sort the better choice?
• Mostly in order
When is a merge sort the better choice?
• Longer list • Completely randomised • Reversed data set
What is a linear search?
• Go through every value one by one
What is a binary search?
• Isolate the right or left of the list depending on the value through the middle • Continue to narrow down