algorithms Flashcards

1
Q

What is an algorithm?

A

An algorithm is a sequence of steps which can be followed to complete a task.

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

Explain the term decomposition?

A

Decomposition is when a problem is broken down into multiple smaller problems, so that each smaller problem accomplishes an identifiable task.

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

What is abstraction?

A

It is the process of removing unnecessary detail from a problem.

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

What is a linear search?

A

A linear search will check each item in the array from the start until it has found the item.

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

Describe a binary search?

A

In a binary search the item in the middle will be checked first.

If that isn’t the item, it it will decide if the item is smaller or greater.

Finally, it will discard half of the items and check the middle item again until is has been found.

It only works on data that is sorted in an order.

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

What is sorting data?

A

It is when data is put into an order.

Usually numerical or alphabetical, ascending or descending.

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

What is a bubble sort algorithm?

A

Each item in the list is compared to the one next to it. If the item is greater then they swap places.

After one full pass the largest item will be at the end of the list.

This is repeated until the whole list is in order.

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

Pro and con of bubble sort algorithms.

A

They are not very efficient for sorting items of data.

Easier to write and are still effective when number of items isn’t too large.

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

What is a merge sort algorithm?

A

It divides the unsorted list into sublists, with each one containing one element.

Continually merge two sublists together to make one sublist until there is only one sorted list left.

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

pro and con of merge sort algorithms.

A

Merge sort algorithms are much more efficient.

However they require more memory to store the sublists.

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