Algorithms Flashcards

1
Q

What is abstraction?

A

Hiding or removing unnecessary data to keep something simple

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

What is decomposition?

A

Breaking down a problem into smaller subproblems

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

What is 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
4
Q

What symbol is used to represent an input in a flow chart?

A

Parallelogram

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

What symbol is used to represent an output in a flow chart?

A

Parallelogram

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

What symbol is used to represent a decision in a flow chart?

A

Rhombus

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

What symbol is used to represent a process in a flow chart?

A

Rectangle

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

What symbol is used to represent a terminal in a flow chart?

A

Oval

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

What symbol is used to represent a subroutine in a flow chart?

A

Rectangle with two vertical lines near each end of the shape

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

What is used to connect each symbol in a flow chart?

A

An arrow

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

Name two examples of decomposition

A
  • Flow charts
  • Structure diagrams
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a structure diagram?

A

A way of visually showing the breakdown of a program into individual steps (subroutines)

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

What are trace tables?

A

Tables used in testing that show every variable change in a program

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

When would you use a trace table?

A
  • When testing
  • When checking for logic errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a syntax error?

A

An error that will prevent the code from executing

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

What is a logic error?

A

An error that will still allow a program to run, but it won’t work as intended

17
Q

What are the 2 types of searching algorithm?

A
  • Binary search
  • Linear search
18
Q

What are the 3 types of sorting algorithm?

A
  • Bubble sort
  • Merge sort
  • Insertion sort
19
Q

Why would you use a linear search over a binary search?

A

The list doesn’t need to be ordered

20
Q

Why would you use a binary search over a linear search?

A

Because it is usually quicker

21
Q

How does a linear search work?

A

Each element in the list is checked in order until the correct one is found

22
Q

How does a binary search work?

A
  • The midpoint of the list is checked
  • If the value is higher than the element being searched for the middle element and all greater than it are discarded
  • Otherwise the midpoint and all elements bellow it are discarded
  • This happens until the desired element is found
23
Q

How do you find the midpoint of a list?

A

Add the two end points (the element number, not the value) and divide them by 2

24
Q

Which is the most efficient sorting algorithm?

A

Merge sort

25
Q

Which is the least efficient sorting algorithm?

A

Bubble sort

26
Q

How does a bubble sort work?

A
  • During each pass the first two elements are checked and if in the wrong order is swapped, then the next two elements are checked
  • Passes happen until one pass results in no swapping
27
Q

How does a merge sort work?

A
  • The list is divided into individual elements
  • Each element is ordered in a sublist with the one next to it
  • The sublists merge whilst being ordered until there is only one list
28
Q

What is computational thinking?

A

The use of computers to solve a problem