Problem Solving and Algorithms Flashcards

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

What is an algorithm?

A

A set of unambiguous instructions for solving a problem or sub-problem in a finite amount of time using a finite amount of data.

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

What are the two methodologies used to develop computer solutions?

A

Top down and Object-oriented design.

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

What is top-down design?

A

It’s where the design focuses on the tasks to be done?

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

What is object-oriented design?

A

A design that focuses on the data involved on the solution.

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

What are simple data types?

A

Data types which are not further broken down into other data types. This includes integers, characters, Boolean values…

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

What are composite data types?

A

Data types which are aggregation of other data types in some way. These aggregated types themselves may be composite or atomic.

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

What are records?

A

A heterogenous (multiple data types) collection of individual items that are accessed by name. Can contain different atomic types.

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

What are arrays?

A

A homogenous (same type of data) collection of items in which an individual item is accessed by its position within the collection.

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

How does a sequential search work on an unsorted array?

A

A linear search that looks through every element in the array until a value is found or the end of the array has been reached, thus the value not in the array.

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

What is a sequential search with a sentinel value?

A

Similar to a sequential search with the only difference being that the search item is indexed at the end of the array so that if it’s found at the position equal to the size of the array the desired value is not in it. This gets rid of one of the conditions in the array.

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

What is the worst case scenario for the sequential search algorithm?

A

O(n)

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

What is a sorted array?

A

An array where elements are indexed in ascending or descending order within the array.

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

How does a binary search work?

A

Search begins in the middle of the array and checks if the value is in the middle. If not it determines whether the search value is less than or greater than the middle value. If value is less it will eliminate the upper half of the program and repeat the same process on the remaining data until found or not found.

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

What condition must be met in order for a binary search to work?

A

The list/array must be sorted.

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

How does selection sort work?

A

On each pass it goes through the list and searches for the smallest value and once found inserts it into the first index. On the next pass it finds the next smallest value and inserts it into the second index. This process is continued until all elements are inserted into the correct position.

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

What is the time complexity for selection sort?

A

O(n^2)

17
Q

What is the time complexity for Binary Search?

A

O(logb(n))