3.1+3.2 Flashcards

1
Q

What is linear search?

A

Linear search is for when the data is unsorted and runs through every single item.

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

What is binary search?(2)

A

Binary search is performed when a list is sorted and is much more efficient than linear search.
It works by repeatedly dividing in half the portion of the data list.

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

What are the differences between linear and binary search?

A

Linear search is very inefficient for a large number of items, the average time taken to search 1000 items will be 100 times longer than the time taken to search 10 items. However, linear search can be done on an unsorted list.
In contrast the binary search algorithm is extremely efficient. In a list of 10 million items, only 24 items would need to be examined.

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

What is bubble sort?(2)

A

Bubble sort works by repeatedly going through the list to be sorted comparing each pair of adjacent elements.
Bubble sort is much less efficient and slower than Merge sort on average.

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

What is merge sort?(2)

A

Two stage sort. Divides list in half and then divides each half in half again so on. This is done until there are only 2 items in each sublist.
These are then compared and then the sublist are put back together.
Takes up additional storage than bubble sort.
Algorithm is more difficult to code.

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

Define an algorithm.

A

An algorithm is a sequence of steps to be followed in order to complete a task.

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

Define decomposition.

A

Decomposition is the breaking of a problem into a number of smaller problems that are more manageable.

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

Define abstraction

A

Abstraction is the process of removing unnecessary detail from a problem in order to help solve it.

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

What is a subroutine and why are they used?(2)

A

A subroutine is a named, self-contained section of code performing a specific task.
These are useful because a piece of code that may appear multiple times in a programme will only have to be written and debugged once. They also make program structure clear.
Modules written in programmes can also be easier to maintain and reused in future programmes.

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

What are the two types of subroutines?

A

Procedures and functions.

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

What is algorithm efficiency?

A

Efficiency looks at how much time it takes to run a particular algorithm and how much memory is needed.

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

What makes algorithms more efficient?(2)

A

Fewer steps of code are executed. The program will take less time to complete.
Less memory is used, for example due to less variables used or fewer lines of code.

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