2.1 Algorithms Flashcards

1
Q

Define abstraction

A

Removing unnecessary details

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

Define decomposition

A

Breaking complex problems into smaller parts
Easier to work with
Solve at the same time
Shown in structure diagram

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

Define algorithmic thinking

A

Identifying individual steps needs to reach the solution
Allows to automate solutions

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

What are the two searching algorithms

A

Binary
Linear

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

Describe how to do a binary search

A

Look at middle number
Compare to target number and discard half of list to big/ to small to the target
Process starts again until target is found

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

Pros of binary search

A

Efficient and quicker than linear
Fewer comparisons

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

Cons of binary search

A

List must be in order

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

What is linear search

A

Each item in the list is checked one at a time from left to right until target number is found

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

Pros of linear search

A

Doesn’t need to be in order
Simple to run and create

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

Cons of linear search

A

Very slow
Inefficient and requires lots of comparisons

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

What flowchart diagram is this

A

Start/end

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

What flowchart diagram is this

A

Decision

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

What flowchart diagram is this

A

Input or output

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

What flowchart symbol is this

A

Process

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

What flowchart symbol is this

A

Sub program

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

What is a syntax error

A

Error in spelling or grammar used when coding which causes an error message

17
Q

What is a logic error

A

Mistake in the programs code which results in unexpected behaviour although the code is correct

18
Q

What is a trace table

A

Table that follows the values of variables to check for accuracy

19
Q

What is iteration

A

A FOR loop - loop number is known as
A WHILE loop - loop number is unknown

20
Q

What is selection

A

IF
ELSE
ELIF

21
Q

What are the three sorting algorithms

A

Bubble
Insertion
Merge

22
Q

What is bubble sort

A

Compares two numbers
Numbers are swapped if left is greater
Process repeated until list is in order
Goes through list an extra time to check its in order

23
Q

Pros and cons of bubble sort

A

Pros - simple to create/run
Cons - slow,inefficient and requires lots of comparisons

24
Q

What is insertion sort

A

Puts first number in sorted list
Compares rest of numbers in un sorted list with sorted list
Inserts it into the correct place

25
Q

Pros and cons of insertions sort

A

Pros- faster and fewer comparisons
Cons-more complicated than bubble

26
Q

What is merge sort

A

Splits into individual lists
Single numbers into groups of two sorting as they merge
Groups of 2 into groups of 4
Repeat until it’s one list

27
Q

Pros and cons of merge sort

A

Pros - Efficient for long lists
Cons - inefficient for small lists or lists that are slightly out of order