Fundamentals of Algorithms Flashcards

1
Q

What is an algorithm?

A

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

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

Define decomposition.

A

Decomposition means breaking a problem into a number of sub-problems, so that each sub-problem accomplishes an identifiable task, which might itself be further subdivided.

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

Define abstraction.

A

Abstraction 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 are the advantages of linear search?

A

~easy to understand and implement
~more versatile
~data doesn’t need to be sorted
~Can be applied to arrays, linked lists, and other data structures without modification.

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

What are the disadvantages of linear search?

A

~slow and inefficient for large datasets
~Even if the data is sorted, Linear Search doesn’t take advantage of this, resulting in potentially unnecessary comparisons.
~Requires checking each element sequentially, which can be slow

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

What are the advantages of binary search?

A

~faster than Linear Search for large datasets
~less comparisons
~Performs well on large datasets

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

What are the disadvantages of binary search?

A

~The list or array must be sorted
~More complex to implement and understand than Linear Search
~less versatile
~more storage space as harder to code

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

What are the advantages of bubble sort

A

~suitable for small amounts of data
~easy to program
~doesn’t use as much memory

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

what are the disadvantages of bubble sort?

A

~slow
~not suitable for large amounts of data

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

what are the advantages of merge sort

A

~quick
~suitable for large amounts of data

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

what are the disadvantages of merge sort

A

~unsuitable for small amounts of data
~hard to program
~uses lots of memory when a bigger list

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

what is linear search?

A

Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed.

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

what is merge sort?

A

A sorting algorithm that repeatedly passes through a list to be sorted, comparing and swapping items that are in the wrong order. The merge sort algorithm repeatedly divides a list into two until all the elements are separated individually.

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

what is binary search?

A

A binary search is a way of looking for a piece of data in an ordered list by continually splitting the list in half. You then check the middle number and work out which half of the list the value to find it.

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

what is bubble sort?

A

It is a simple sorting algorithm that repeatedly steps through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed.

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