2.1 Algorithms Flashcards
Define Computational Thinking
Computational thinking is about the steps taken to find a solution to a complex problem. It involves decomposition, abstruction and algorithmic thinking.
Define decomposition
Decomposition is breaking down a complex problem into smaller problems and solving each one individually. Each individual problem can be separately tested and solved. Can be recombined to produce full solution.
Define abstraction
Abstraction involves picking out the important bits of information from the problem and ignoring the specific, unnecessary information that doesn’t matter. Simplifies problem and makes it straightforward to understand.
Define algorithmic thinking
Algorithmic thinking is a logical way of getting from a problem to a solution. If the steps you take follow an algorithm, this can be used again in the future.
Define pseudocode
Pseudocode is not an actual programming language. It shows the steps of the algorithm without the need to follow syntax. It can easily be followed by a coder.
Define flowcharts
Algorithms can be shown using a flowchart. Flowcharts use different shape boxes for different commands.
Define search algorithm
Computers follow a search algorithm to find items in a list e.g. searching for a shopping website, searching for appointments at a doctor surgery.
Define binary search
Binary search looks for items in an ordered list. This list can contain letters, numbers or alphanumeric characters.
Define linear search
A linear search can be used on an unordered list. This type of search checks each item in turn and stops when it finds the item or reaches the end of the list.
Define sorting algorithm
Computers follow a sorting algorithm to sort items in the list. E.g. sorting a list of names in Excel, shopping website – sorting a list from lowest to highest price.
Define bubble sort
The bubble sort algorithm compares pairs of items. It is very simple, but can take a long time to sort long lists.
Define merge sort
Emerge thoughts, let’s the list apart the merge that back together. This is much more efficient than the bubble sort for larger lists, but much slower for shorter lists.
Define insertion sort
Insertion sort orders the items as it goes. Insertion sort is a very simple algorithm and works very well with small lists. It is not very efficient for larger lists.
Define dry run
Walking through an algorithm with sample data, running each step manually.
Define algorithm
The series of steps to solve a problem or perform an action
Define flowchart
A diagram that shows the inputs, outputs and processes in an algorithm
Define process
An action that takes place
Define pseudocode
Simplified, not language specific style used to design algorithms
What is algorithm?
A set of instructions presented in a logical sequence
What do the different flowchart symbols represent?
Oval - start/ end
Rectangle - process
Rectangle which is cut - subroutine
Diamond - decision
Parallelogram - input/ output
Trace table
Track the values of variables as the program is run
Sequence
Structuring code in a logical, sequential order
Selection
Decision making using if statements
Iteration
Repeating code using for or while loops
Variable
Stores data in programs. The value can change as the program is run. Two parts, data value and identifier.
Local variable
Declared within a subroutine and can only be used within that subroutine
Saves memory
Easier to debug
Reused
Global variables
Are used at any point in the whole program
Maintenance easier
Used for constants
Constants
Doesn’t change in value as the program is run
MOD
Returns remainder
DIV
Returns whole number