Algorithms Flashcards
(9 cards)
What is the name of the process that breaks down a large problem into a smaller problem that can be solved separately?
Decompression.
What is an algorithm?
A step by step set of instructions to solve a problem.
T or F? Some algorithms can be only written by using flow diagrams.
False. Any algorithm can be written in plain English/Pseudo-code/Flow diagrams.
What is a binary search?
It is a search which finds a specific number.
How does binary search work?
The array is sorted in ascending order and then the middle value is picked out. If the value is less than the specific number then only the right side of the array is taken. If the number is bigger, then the left side is take and this procedure is repeated until the specific number is located.
What is a bubble sort?
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order.
How does a bubble sort work?
It goes through each pair of the array and then it puts them in size order.
What is merge sort?
It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves.
How does the merge sort work?
It keeps on splitting the array into pairs until they are all single digits. Then it compares the nearest 2 digits and puts it in ascending order. The step is repeated until all the pairs are sorted and put in the right order.