2.1 Algorithms Flashcards
What is computational thinking?
A problem-solving method using computer science techniques, where possible solutions are developed and presented in a way that can be understood by humans and computers.
What is decomposition?
Breaking down a complex problem or system into smaller parts that are more manageable and easier to understand.
What is abstraction?
The process of extracting or withdrawing something.
What is a syntax error?
error in the syntax of a sequence of characters that is intended to be written in a particular programming language
What is a logic error?
a mistake in a program’s source code that results in incorrect or unexpected behavior.
What is the rectangle in a flowchart?
process
How do you perform a Linear search?
Starting at the beginning of the data set, each item of data is examined until a match is made. Once the item is found, the search ends.
How do you perform a binary search?
- Start by setting the counter to the middle position in the list.
- If the value held there is a match, the search ends.
- If the value at the midpoint is less than the value to be found, the list is divided in half. The lower half of the list is ignored and the search keeps to the upper half of the list.
- Otherwise, if the value at the midpoint is greater than the value to be found, the upper half of the list is ignored and the search keeps to the lower half of the list.
- The search moves to the midpoint of the remaining items. Steps 2 through 4 continue until a match is made or there are no more items to be found.
How do you perform a bubble sort?
- Start at the beginning of the list.
- Compare the first value in the list with the next one up. If the first value is bigger, swap the positions of the two values.
- Move to the second value in the list. Again, compare this value with the next and swap if the value is bigger.
- Keep going until the there are no more items to compare.
- Go back to the start of the list.
How do you perform a merge sort?
The list is repeatedly divided into two until all the elements are separated individually. Pairs of elements are then compared, placed into order and combined. The process is then repeated until the list is recompiled as a whole.
How do you perform an insertion sort?
An insertion sort compares values in turn, starting with the second value in the list. If this value is greater than the value to the left of it, no changes are made. Otherwise this value is repeatedly moved left until it meets a value that is less than it. The sort process then starts again with the next value. This continues until the end of the list is reached.
What is the diamond in a flowchart?
Decision
What is the parallelogram in a flowchart?
input/ output
What is the arrow in a flowchart?
represents the flow