2.1 Algorithms Flashcards

1
Q

Decomposition

A

breaking a complex problem down into smaller problems and solving each one individually

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

Abstraction

A

picking out the important bits of information from the problem, ignoring the specific details that don’t matter

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

Algorithmic Thinking

A

a logical way/set of instructions to solve a problem -> as an algorithm

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

What do computer systems do?

A

Input -> process -> output

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

Flowcharts

A

Visually represent an algorithm

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

Flowchart: Arrow

A

Connects boxes
Shows flow of data through program

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

Flowchart: Rectangle

A

Process
General instructions, processes and calculations

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

Flowchart: Parallelogram

A

Input/output

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

Flowchart: Diamond

A

Decision -> YES or NO

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

Flowchart: Curved cornered rectangle

A

Terminal -> Start/Stop

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

Flowchart: rectangle with lines

A

Sub program - refers to other flowcharts

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

Pseudocode

A

Shows the outline of an algorithm without worrying about fine details (syntax)

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

Trace Tables

A

Give a simple way of testing a piece of code is working correctly

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

What do columns in trace tables represent?

A

Variables

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

What do rows in trace tables represent?

A

Values that the variable can take at a particular point in an algorithm

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

Standard searching algorithms

A

Binary
Linear

17
Q

Binary Search

A
  1. Find middle term in ordered list
  2. If this is the item you are looking for, stop search
  3. If not, compare item being looked for with middle term
  4. If it is before the middle term, get rid of the second half of the list
  5. If it is after the middle term, get rid of the first half of the list
  6. Repeat with the smaller list until the item is found
18
Q

Advantage of Binary Search

A

Efficient

19
Q

Disadvantage of Binary Search

A

only works with ordered/sorted lists

20
Q

Linear Search

A

Check each term in a sequence sequentially until the item being looked for is found

21
Q

Disadvantage of Linear Search

A

inefficient, only can be used for small list

22
Q

Standard sorting algorithms

A

Bubble
Merge
Insertion

23
Q

Bubble Sort

A
  1. Look at first 2 terms
  2. If ordered move on to next pair
  3. If not ordered, swap them
  4. Repeat until you get through all the terms once = 1 pass
  5. Repeat until there are no swaps in a pass
24
Q

Advantage of Bubble Sort

A

Simple algorithm, efficient to check if a list is in order, little memory used

25
Q

Disadvantage of Bubble Sort

A

Inefficient to sort a list, doesn’t work well with large lists

26
Q

Merge Sort

A
  1. Split list in half (creates 2 sub lists)
  2. Repeat until all the sub lists contain only 1 term
  3. Merge 2 sub lists together and sort into right order
  4. Repeat step 3 until all the sub lists have been merged together
27
Q

Advantage of Merge Sort

A

More efficient than bubble sort and insertion sort for large lists

28
Q

Disadvantage of Merge Sort

A

Even if the terms are already sorted, it goes through the whole process, uses lots of memory

29
Q

Insertion Sort

A
  1. Look at 2nd term in list
  2. Compare it to the terms before it and insert number in right place
  3. Repeat step 2 for all terms
30
Q

Advantage of Insertion Sort

A

Easily coded, good with small lists, quick

31
Q

Disadvantage of Insertion Sort

A

Doesn’t cope with large lists