Algorithms Flashcards

1
Q

What is decomposition?

A

Breaking down a complex problem into smaller problems that can each be solved individually.

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

What is abstraction?

A

Picking out important information from a problem and ignoring the rest.

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

What is algorthmic thinking?

A

A logical way of getting from the problem to the solution. If the steps taken to solve a problem follow an algorithm then they can be adapted to other problems.

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

What is the shape for start or stop in a flowchart?

A

Rounded rectangle

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

What is the shape for inputs/outputs in a flowchart?

A

parallelagram

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

What is the shape for processes in a flowchart?

A

Rectangle

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

What is the shape for decisions in a flowchart?

A

Diamond

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

What is the shape for subroutines in a flowchart?

A

A rectangle with an additional parallel line going down on either side.

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

What are the three types of flowcharts?

A
  • Sequences,
  • Iteration,
  • Selection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are search algorithms?

A

Instructions that search for a specific set of data in a data set.

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

What are the two main types of search algorithms?

A
  • Binary

- Linear

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

How does binary search work?

A
  • Take the middle value of your set of sorted data using (n + 1)/2
  • If this data is what you are looking for you are done,
  • If not, compare the item you are looking for with the middle item, if it is greater then get rid of the lower side from the middle term, if it is smaller than the middle item then get rid of the greater side of the data,
  • Repeat steps 1 to 3 until you have found your data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does linear search work?

A

It goes through a whole list (does not have to be ordered, unlike binary search) and looks for your item one item at a time.

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

What are sorting algorithms?

A

They are sets of instructions that sort data in order.

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

What are the two main types of sorting algorithms?

A
  • Bubble,

- Merge

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

What is a bubble sort and how does it work?

A

It compares two items, if they are in the correct order they do not switch, if they are in the wrong position they do, then moves onto the next pair (from pairs 1/2 to pairs 2/3). When the whole set of data is gone through once, the process starts again, this is called a pass.

17
Q

What are the pros and cons of bubble sort?

A

Pros:
- Simple/ easily implemented into a computer,
- Efficient to check if a list is already in order,
- Doesn’t use a lot of memory,
Cons:
- An inefficient way of sorting lists that are poorly sorted,
- Also slow at sorting large lists

18
Q

How does merge sort work?

A
  • Two lists are continuously split until they separate into their single units,
  • The separate units then merge with the one one next to them, in order using the bubble method.
  • These pairs then merge with other pairs, in order, this is done until the data is completely compiled into one long set of sorted data.
19
Q

What are the pros and cons of merge sort?

A

Pros:
- Generally more efficient and quicker than bubble sort for larger lists and has a similar running time for short lists,
- Very consistent running times,
Cons:
- Resorts the list if it is already sorted, so bubble may be quicker in some scenarios,
- Uses more memory than bubble sort because they need to make multiple lists.