2.1 Algorithms STARTED Flashcards

1
Q

Define linear search

A

A sequence that checks every item in a list 1 by 1 until it finds the desired item.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define binary search

A

A sequence that finds the desired item of a list according to the midpoints.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens if the midpoint is greater than the desired item?

A

It scraps the midpoint and the data to its left and checks again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What happens if the midpoint is smaller than the desired item?

A

It scraps the midpoint and the data to its right.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define bubble sort

A

Bubble sort makes multiple passes through a list. It compares items and changes those that are out of order. Each pass through the list places the next largest value in its proper place.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How are numbers sorted in bubble sort?

A

Compares 1st 2 items and swaps them if necessary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define pass

A

A full cycle of swapping (doesn’t mean list is sorted).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define insertion sort

A

A more efficient version of bubble sort. Each pass would insert each number into its correct place.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are numbers sorted in insertion sort?

A

Compares 1st 2 items and inserts the necessary item into its complete correct position rather than swapping them. Has 2 lists, unsorted and sorted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where is insertion sort very efficient?

A

A small data set or where data is mostly sorted. E.g. a pack of cards.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is merge sort?

A

An efficient sequence that divides an unsorted list into sublists with 1 item each and merges the lists together until it has a complete sorted list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Define computational thinking

A

Use of computers to solve problems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Define abstraction

A

Representing “real world” problems in a computer using variables and symbols and removing unnecessary elements from the problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Define decomposition

A

Breaking down a large problems into smaller sub-problems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Define algorithmic thinking

A

Identifying the steps involved in solving a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Computational thinking

A

Describes the thought processes involved in understanding problems and formulating solutions in such a way that they can be carried out by computers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Decomposition

A

Reduces a problem into sub-problems or components. These smaller parts are easier to understand and solve

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Decomposition is an example of what type of approach?

A

Divide-and-conquer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Abstraction

A

Identifies essential elements that must be included in the computer models of real-life situations and discards the inessential ones

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is pattern recognition sometimes called?

A

Generalisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Pattern recognition is used to identify where constructs such as what can be used?

A

selection and iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Pattern recognition is used to identify where sections of code can be ______ (functions and procedures)

A

reused

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Pattern recognition is used to recognise a problem that is similar to…

A

one you have solved in the past

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Pattern recognition is used to reuse code, functions and procedures from past programs to…

A

carry out similar functions in a new program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Algorithmic thinking is a subset of computational thinking that involves...
defining a clear set of instructions to solve a problem
26
With algorithmic thinking, once a successful solution to a problem has been found...
it can be used repeatedly for the same problem
27
The process of adding up all the numbers and diving the total by the number in the set to calculate the mean is an example of...
Algorithmic thinking
28
Algorithms provide instructions needed to...
solve a problem
29
All computer programs are what?
Algorithms
30
An algorithm is a step-by-step procedure for...
solving a problem or carrying out a task
31
How are algorithms often used to improve efficiency?
By removing the need for human input - a computer following an algorithm can do things in split seconds compared to humans
32
What are the three constructs used in an algorithm?
Sequence, selection and iteration
33
Sequence
Instructions need to be given in the correct order
34
Selection
Decisions have to be made and a course of action selected
35
Iteration
Previous steps are repeated until there is a desired outcome
36
Once an algorithm has been written, it can be...
reused with slight changes for solving similar problems
37
Why do we reuse algorithms?
It is much quicker than starting from scratch each time
38
True/False: Algorithms can be displayed using pseudocode
True
39
Pseudocode is a way of expressing an algorithm in...
structured English that resembles a computer language
40
True/False: There is only one way to write pseudocode
False, there are many different varieties of pseudocode
41
Pseudocode uses what similar to those found in computer languages?
Commands, keywords and structures
42
Pseudocode can/cannot be understood by computers
cannot
43
Pseudocode is used to develop the logic of an algorithm without having to bother about what?
syntax
44
A human can/cannot follow the logic of an algorithm even if there are spelling mistakes or missing brackets
can
45
A human can follow the logic of an algorithm even if there are spelling mistakes or missing brackets but a computer...
cannot execute code if there are similar syntax errors
46
A solution in pseudocode is converted into...
a programming language such as Python or Java
47
How can you add comments to code?
// or #
48
Why are comments used in code?
To help others follow programmers' logic, and to act as a reminder of the logic
49
How does indenting help with the logic of an algorithm?
It shows dependency
50
What does this symbol in a flowchart represent?
Start/stop
51
What does this symbol in a flowchart represent?
Input/output
52
What does this symbol in a flowchart represent?
A decision - shows yes/no or true/false decisiopns where there are two possible outcomes
53
What does this symbol in a flowchart represent?
A process - for example a calculation
54
What does this symbol in a flowchart represent?
A subroutine - shows a function or procedure that has its own flow diagram
55
What do lines in flow charts represent?
Control passing between symbols
56
What does the start/stop symbol in a flow chart show?
The start and end of an algorithm
57
What does the input/output symbol in a flowchart show?
Input or output of data
58
What does the decision symbol in a flowchart show?
Yes/no or true/false decisions where there are two possible outcomes
59
What does the process symbol in a flowchart show?
Data processing, for example a calculation
60
What does the subroutine symbol in a flowchart show?
A function or procedure that has its own flow diagram
61
When large amounts of data are searched, it is essential that the searching algorithm is as...
efficient as possible
62
What type of algorithm are linear and binary?
Standard search algorithms