Algorithms Flashcards
what is abstraction?
picking out the important details in a problem
what is decomposition?
breaking a larger problem down into smaller problems
what is algorithmic thinking?
the logical steps you take to get from a problem to a solution
what is pseudo code?
code which clearly shows the steps an algorithm takes without needing to follow syntax
In a flowchart, what does the oval shape represent?
start and stopping of the flowchart
In a flow chart, what does the paralelogram shape represent?
input/output
In a flow chart, what does the rectangle with vertical lines on the inside represent?
sub routine
In a flow chart, what does the rectangle represent?
processing/calculation
In a flow chart, what does the diamond represent?
decision
In a flow chart, what does the arrow represent?
connects the commands together
Which requires a list to be sorted, binary search or linear search?
binary search
How does a binary search work?
Finds the middle of the list, and decides if the item is higher or lower than the number being searched. If it is higher, then it will search in the higher part of the list or ‘right’, or if it is lower, then it will search the lower part of the list, or ‘left”. It repeats this until the time is found.
How does a linear search work?
Searches the item one by one in a list until found
How does an insertion sort work?
Splits the list into 2 parts, sorted and unsorted. Starting with the first item in the list, it moves on to the next item in the list, where it decides where it should go in the sorted list. It is not very efficient for larger lists.
How does a merge sort work?
Divides the list in 2 each step, before there is one list for each item. It then merges 2 lists together, sorting them in the process. It continues this until there is one big sorted list. More efficient on larger lists.
How does a bubble sort work?
Starts with the first item in the list, and compares it to the next. If the item is higher, it will swap them round and the item compares with the next item. If the item is lower, the higher item will be then compared with the next item along. It should end up with the highest item in the list at the end of the list, and that counts as a pass. It then repeats theses steps until the list is sorted
what is a syntax error?
an error that is caused by incorrect spelling or grammar by the programmer
what is a logical error?
an unexpected mathematic result that is caused by incorrectly using <, >, AND or OR