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
Q

Algorithmic thinking is a subset of computational thinking that involves…

A

defining a clear set of instructions to solve a problem

26
Q

With algorithmic thinking, once a successful solution to a problem has been found…

A

it can be used repeatedly for the same problem

27
Q

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…

A

Algorithmic thinking

28
Q

Algorithms provide instructions needed to…

A

solve a problem

29
Q

All computer programs are what?

A

Algorithms

30
Q

An algorithm is a step-by-step procedure for…

A

solving a problem or carrying out a task

31
Q

How are algorithms often used to improve efficiency?

A

By removing the need for human input - a computer following an algorithm can do things in split seconds compared to humans

32
Q

What are the three constructs used in an algorithm?

A

Sequence, selection and iteration

33
Q

Sequence

A

Instructions need to be given in the correct order

34
Q

Selection

A

Decisions have to be made and a course of action selected

35
Q

Iteration

A

Previous steps are repeated until there is a desired outcome

36
Q

Once an algorithm has been written, it can be…

A

reused with slight changes for solving similar problems

37
Q

Why do we reuse algorithms?

A

It is much quicker than starting from scratch each time

38
Q

True/False: Algorithms can be displayed using pseudocode

A

True

39
Q

Pseudocode is a way of expressing an algorithm in…

A

structured English that resembles a computer language

40
Q

True/False: There is only one way to write pseudocode

A

False, there are many different varieties of pseudocode

41
Q

Pseudocode uses what similar to those found in computer languages?

A

Commands, keywords and structures

42
Q

Pseudocode can/cannot be understood by computers

A

cannot

43
Q

Pseudocode is used to develop the logic of an algorithm without having to bother about what?

A

syntax

44
Q

A human can/cannot follow the logic of an algorithm even if there are spelling mistakes or missing brackets

A

can

45
Q

A human can follow the logic of an algorithm even if there are spelling mistakes or missing brackets but a computer…

A

cannot execute code if there are similar syntax errors

46
Q

A solution in pseudocode is converted into…

A

a programming language such as Python or Java

47
Q

How can you add comments to code?

A

// or #

48
Q

Why are comments used in code?

A

To help others follow programmers’ logic, and to act as a reminder of the logic

49
Q

How does indenting help with the logic of an algorithm?

A

It shows dependency

50
Q

What does this symbol in a flowchart represent?

A

Start/stop

51
Q

What does this symbol in a flowchart represent?

A

Input/output

52
Q

What does this symbol in a flowchart represent?

A

A decision - shows yes/no or true/false decisiopns where there are two possible outcomes

53
Q

What does this symbol in a flowchart represent?

A

A process - for example a calculation

54
Q

What does this symbol in a flowchart represent?

A

A subroutine - shows a function or procedure that has its own flow diagram

55
Q

What do lines in flow charts represent?

A

Control passing between symbols

56
Q

What does the start/stop symbol in a flow chart show?

A

The start and end of an algorithm

57
Q

What does the input/output symbol in a flowchart show?

A

Input or output of data

58
Q

What does the decision symbol in a flowchart show?

A

Yes/no or true/false decisions where there are two possible outcomes

59
Q

What does the process symbol in a flowchart show?

A

Data processing, for example a calculation

60
Q

What does the subroutine symbol in a flowchart show?

A

A function or procedure that has its own flow diagram

61
Q

When large amounts of data are searched, it is essential that the searching algorithm is as…

A

efficient as possible

62
Q

What type of algorithm are linear and binary?

A

Standard search algorithms