Topic 2.1 - Algorithms Flashcards
(40 cards)
What is an algorithum?
A sequence of steps that can be followed to complete a task.
Define algorithmic thinking.
Is a method for solving complex problems using three principles.
What are the three principles of computational thinking?
Abstraction, Decomposition, Algorithmic thinking
Define abstraction and why is it useful.
Abstraction is the process of simplifying a problem by ignoring irrelevant data and focusing only on the most important details.
Abstraction helps simplify complex problems. When programming abstraction makes it easier to understand, maintain and reuse code.
What are examples of abstraction?
Sort and randint.
Define decomposition.
Breaking down complex problems into smaller more manageable subproblems that are easier to solve
Define algorithmic thinking.
This is the process of designing a step by step plan or set of instructions to solve a problem.
What are the three ways to write algorithum?
Pseudocode, flowchart and program code.
What is pseudocode?
Pseudocode is a way of writing informal instructions in a code like format.
What is a flowchart?
A visual way of representing the steps in a algorithm using specific shapes.
What is program code?
Programmers use high level programming languages like python and java to write code that is translated into a format the CPU can understand and execute.
Define input?
The data entered into a system. This can be manually entered by a human for example typing on a keyboard or automatic.
Define processes.
The actions taken by computer, often using input data.
Define output.
Information provided to the user after processing.
What is a linear search?
Compares each item one by one until target is found.
No need for the list to be in order.
What is binary search?
Compares middle term to the target. Discards half of the list the target can’t be in.
Finds the next middle term and repeats until the target is found.
What is advantage and disadvantage of binary search?
More time efficient than linear search.
But needs to be ordered before hand.
What is bubble sort?
In one pass, go through each pair swapping if needed.
Repeats passes until a pass happens with no swaps.
What is merge sort?
In merge sort divides the list continuously by two Until each list has 1 item.
Then combines two lists at a time, keeping items in order.
What is insertion sort?
Starts with 1 item in the ‘sorted part’ and moves item one by one from the unsorted part to the sorted part.
What are the 5 data types and describe them.
Integer (int) - A whole number
Real or float - A number with a fractional part.
Boolean - True or false
Character - A Letter number or symbol.
String - A group of characters. if it has “” around it.
What are the arithmetic opperations?
- = Multiplication
^ = Exponentiation (to the power of)
/ = Division
DIV = Division but cuts of decimals.
MOD = Gives you remainder when dividing.
What are the comparison fundamentals?
Equal to - ==
Not equal to - !=
Greater than - ?
Greater than or equal to - >=
What are the basics of boolean?
NOT = Flips the value
AND = Both sides needed
OR = Only one side needed