Section 4: Algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Define Computational Thinking.

A

The steps a computer takes to solve a complex problem.

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

What are the three key techniques for Computational Thinking?

A

Decomposition, Abstraction and Algorithmic thinking.

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

Define Decomposition, (computational thinking)

A

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

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

Define Abstraction, (computational thinking)

A

Picking out important 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
5
Q

Define Algorithmic Thinking, (computational thinking)

A

A logical way of getting from the problem to the solution.

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

Define Algorithm.

A

Algorithms are just sets of instructions for solving a problem.

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

Name the three main types of flow diagrams.

A

Sequences, Selection and Iteration

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

Describe a Sequence flow diagram.

A

There is only one way through the diagram, from start to end.

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

Describe a Selection flow diagram.

A

There are multiple ways through the flow diagram from start to end.

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

Describe a Iteration flow diagram.

A

A flow diagram that contains a loop, that allows you to repeat a task.

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

What are the two main search algorithms?

A

Binary Search and Linear Search.

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

State the method of a Binary Search.

A

1) Find the middle item of the ORDERED list
2) If this is the item you’re looking for, then stop the search - you’ve found it.
3) If not found, compare the item you’re looking for with the middle item, if the middle item is larger then get rid of the second half of the list, if the middle item is smaller then get rid of the first half of the list.
4) Repeat steps 1-3 on this new smaller list until you find the desired item.

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

State the method of a Linear Search.

A

1) Look at the first item in the UNORDERED list
2) If this is the item you’re looking for, then stop the search - you’ve found it.
3) If not, then look at the next item in the list.
4) Repeat steps 2-3 until you find the item that you’re looking for or you’ve checked every item.

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

Advantages of Binary Search.

A

1) Binary searches are much more efficient
2) In general, binary searches take less steps to find the item you are looking for, which makes it more suitable for large lists of items.

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

Advantages of Linear Search

A

1) Linear searches are more simpler
2) Linear searches can be used on any type of list , it doesn’t have to be ordered.
3) Could be better for smaller lists

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

Name the three main types of Sorting Algorithms.

A

Bubble Sort, Merge Sort and Insertion Sort

17
Q

State the method of a Bubble Sort.

A

1) Look at the first two items in a list.
2) If they’re in the right order, you don’t have to do anything, if they’re in the wrong order, swap them.
3) Move on to the next pair of items, 2nd&3rd and repeat step 2).
4) Repeat step 3) until you get to the end of the list - this is called one pass. The last item will now be in the correct place, so don’t include it in the next pass.
5) Repeat steps 1-4 until there are no swaps in a pass.

18
Q

Advantages of a Bubble Sort.

A

1) Its a simple algorithm
2) Its an EFFICIENT way to CHECK if a list is already ordered
3) Doesn’t use much memory.

19
Q

Disadvantages of a Bubble Sort.

A

1) Its an INEFFICIENT way to SORT a list.

2) Due to being inefficient, bubble sorts aren’t good for larger lists.

20
Q

State the method of a Merge Sort.

A

1) Split the list in half, (the smaller lists are called sub-lists) - the second sub-list should start at the middle item.
2) Keep repeating step 1) on every sub-list until all the lists only contain one item.
3) Merge pairs of sub-lists so that each sub-list has twice as many items. Each time you merge sub-lists, sort the items into the right order.
4) Repeat step 3) until you’ve merged all the sub-lists together.

21
Q

Advantages of a Merge Sort.

A

1) MORE EFFICIENT for LARGER lists

2) It has a very consistent running time regardless of how ordered the items in the original list are.

22
Q

Disadvantages of a Merge Sort.

A

1) LESS EFFICIENT for SMALLER lists
2) Even if the list is already sorted, it still goes through the whole splitting and merging process.
3) It uses more memory than other sorting algorithms.

23
Q

State the method of an Insertion Sort.

A

1) Look at the second item in a list.
2) Compare it to all items before it and insert the item in the right place
3) Repeat step 2) for the 3rd 4th 5th etc. items until the last item in the list has been inserted into the correct place.

24
Q

Advantages of Insertion Sort.

A

1) Can be easily coded
2) Very efficient for small lists
3) Doesn’t require much memory
4) Very quick at checking a list is already sorted.

25
Q

Disadvantages of Insertion Sort

A

Its main disadvantage is that it is less efficient when used on larger lists.

26
Q

What is the point of Pseudocode?

A

Pseudocode clearly shows an algorithms steps without worrying about finer details such as syntax

27
Q

State the five boxes and commands used in flow diagrams.

A

1) Start/End - Boxes with Rounded Corners
2) Inputs/Outputs - Parallelograms
3) Processes - Rectangles
4) Decisions - Diamonds
5) Sub Routines - Double Rectangle