Unit 6 - Algorithms✔️ Flashcards

1
Q

what are algorithms?

A

a set of instructions for solving a problem or completing a task

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

what does abstraction mean in relation to algorithms?

A

abstraction - involves removing unnecessary detail from a problem so that you can focus on the essential components

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

what is decomposition in relation to algorithms?

A

decomposition involves breaking down a large problem into small sub-problems - then the sub problems can be broken down further until each small task is manageable

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

advantages of decompostion?

A

-problem becomes easier to solve when it consists of a number of small subtracts or modules

-some modules can be reusable in other programs saving development time

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

why is a structure diagram used?

A

used to show how a problem is broken down into sub sections

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

define algorithm thinking?

A

an approach to solving problems by the use of algorithms

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

why might a linear search be used?

A

if the list to be searched is not sorted it is not possible to do a binary search

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

define how a linear search works?

A

each item in the list is checked against the search item in order

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

define how a binary search works?

A

the middle item is checked first if the item searched for is greater then it - the items to the left will be discarded and a binary search will be carried out on the right side by repeating the process of splitting the middle item and discarding the side which does not contain the desired item

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

why might a binary search not always work?

A

only works on a sorted list

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

4 examples of data that needs to be sorted?

A

-directories
-house numbers
-library books
-stock in a warehouse

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

why are computers more efficient with a sorted list?

A

they can use a binary search which is far more efficient then a linear search

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

name three algorithms which can be used to sort lists of data?

A

-bubble sort
-insertion sort
-merge sort

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

which algorithm is generally the most efficient?

A

merge sort is generally faster to sort lists

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

features of an insertion sort?

A

-algorithm sorts one data item at a time

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

what are the steps of merge sort?

A

1)divide the unsorted list in two
2)continue to divide lists in two until just one item in each list
3)merge each list back until there is only one list remaining (which will be fully sorted)

17
Q

what are the steps for bubble sort?

A

1)compare the item with the one next to it
2)if the one next to it is less - swap the items
3)repeat for all the other items
4)at the end of one pass through the list the largest item is at the end of the list

18
Q

how does insertion sort work?

A

1)one item is taken from the list and placed in the correct position
2)this is repeated until there are no more unsorted items in the list