Unit 1 - Fundamentals of algorithms Flashcards
Define the term “algorithm”
An algorithm is a sequence of steps that can be followed to complete a task; for example, a computer program
Define the term “decomposition”
Decomposition is the breaking down of a problem into smaller sub-problems which can be broken down further until each small task is manageable
State the advantages of decomposition
Advantages of decomposition are:
* The problem becomes easier to solve when it consists of a number of small modules
* Some modules can be reused in other programs which saves development time
Define the term “abstraction”
Abstraction is the process of removing unnecessary detail from a problem so that you can focus on the essential components
Define the term “variable”
A variable is a location in memory where you can temporarily store a value such as a string
Define the terms “sequence”, “selection”, and “iteration”
- Sequence - a series of steps which are completed one after the other
- Selection - the ability to choose different paths through a program
- Iteration - repeating a part of the program
What is this flowchart symbol?
Start/End - this begins and ends all flowcharts - the shape is called a terminator
What is this flowchart symbol?
Arrow - this shows the relationship between the representative shapes
What is this flowchart symbol?
Input/Output - this either asks the user to input information or displays information
What is this flowchart symbol?
Process - maths operations and assignment of variables
What is this flowchart symbol?
Decision - changes the flow of the program based on a decision
What is this flowchart symbol?
Subroutine - calls a different function or procedure
What is an “integer”?
An integer is a whole number
What is a “real”?
Also known as a “float”
A real is a number with a decimal point
What is a “boolean”?
A boolean is something which can only be true or false
What is a “character”?
A character is a single alphabetic or numeric character”
(e.g. “a”, “K”, “4”, “@”, “%”, etc)
What is a “string”?
A string is one or more characters enclosed in quote marks
(e.g. “I severly dislike having to study this”)
What is “pseudocode” and why is it used?
Pseudocode is a structured English for describing algorithms, allowing programmers to focus on the logic of the program without being distracted by the exact syntax of the programming language
What is meant by “linear search” and how does it work?
A linear search is a way of sorting a list by going through each item in sequence in the list and eliminating it until the desired item is found.
State the advantages and disadvantages of linear search.
Linear search can work with any unsorted list but can take a long time if the list is very long