CS Flashcards

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

Sequential Search

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

Also known as linear search

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

Considered to be simplest search algorithm

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

It works by iterating through a set of data sequentially until you find the item you are looking for.

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

The pseudocode is as simple as a for loop containing an if statement.

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

Things to note about sequential search

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

Data does not need to be sorted

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

On one hand it can save a lot of processing time

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

On another hand

A

you would need to go through the whole or most of the array in some cases

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

If the data was sorted you could put a test to see if we are at a stage where we are past where the number would be and stop the search and return not found.

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

Binary Search

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

Divides a range of values into halves ( divide and conquer)

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

Continues to narrow down the field of search by half until the value being searched is found.

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

Data must be presorted

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

Very efficient for large arrays

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

Ideal when resorting is not required

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

High level algorithm of binary search

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

Compare the search value with the value of the middle element of the array

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

If the values match

A

then the value is found

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

If the search value is less than the middle element

A

then the right half of the array is discarded

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

The new array becomes the left sub array and the algorithm is repeated on it.

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

If the search value is greater than the middle element’s value

A

then the left side of the array is discarded.

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

The new array becomes the right subarray and the algorithm is repeated on it

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

If the remaining array to be searched is empty then the value was not found.

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

Bubble sort

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

Simple sorting algorithm

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

Repeatedly steps through the array to be sorted

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

It compares adjacent elements and exchanges them if they are not in the correct order

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

After each loop

A

one less element needs to be compared

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

The algorithm is very slow and impractical for most cases

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

Selection Sort

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

Simple and inefficient sorting algorithm

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

Divides array into two sections

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

First section contains already sorted elements

41
Q

The second contains the unsorted elements

42
Q

At the beginning the section that contains the sorted elements is empty

43
Q

And the section with the unsorted elements is the entire array

44
Q

The algorithm finds the smallest element ( or largest depending on sorting order) in the unsorted section and exchanges it with the leftmost element in the unsorted section

45
Q

uggest a suitable algorithm to solve a specific problem

47
Q

Efficiency: amount of the computer resources required to perform its functions. Minimizing the use of various resources such as the CPU and memory is important.

48
Q

Correctness: the extent to which the algorithm satisfies its specification

A

free from fault

49
Q

Reliability: refers to the capability of the algorithm to maintain a predefined level of performance

50
Q

Flexibility: effort required to modify the algorithm for other purposes

51
Q

Sequential Search

53
Q

Also known as linear search

54
Q

Considered to be simplest search algorithm

55
Q

It works by iterating through a set of data sequentially until you find the item you are looking for.

56
Q

The pseudocode is as simple as a for loop containing an if statement.

57
Q

Things to note about sequential search

59
Q

Data does not need to be sorted

60
Q

On one hand it can save a lot of processing time

61
Q

On another hand

A

you would need to go through the whole or most of the array in some cases

62
Q

If the data was sorted you could put a test to see if we are at a stage where we are past where the number would be and stop the search and return not found.

63
Q

Binary Search

64
Q

Divides a range of values into halves ( divide and conquer)

65
Q

Continues to narrow down the field of search by half until the value being searched is found.

66
Q

Data must be presorted

67
Q

Very efficient for large arrays

68
Q

Ideal when resorting is not required

69
Q

High level algorithm of binary search

71
Q

Compare the search value with the value of the middle element of the array

72
Q

If the values match

A

then the value is found

73
Q

If the search value is less than the middle element

A

then the right half of the array is discarded

74
Q

The new array becomes the left sub array and the algorithm is repeated on it.

75
Q

If the search value is greater than the middle element’s value

A

then the left side of the array is discarded.

76
Q

The new array becomes the right subarray and the algorithm is repeated on it

77
Q

If the remaining array to be searched is empty then the value was not found.

78
Q

Bubble sort

80
Q

Simple sorting algorithm

81
Q

Repeatedly steps through the array to be sorted

82
Q

It compares adjacent elements and exchanges them if they are not in the correct order

83
Q

After each loop

A

one less element needs to be compared

84
Q

The algorithm is very slow and impractical for most cases

85
Q

Selection Sort

86
Q

Simple and inefficient sorting algorithm

87
Q

Divides array into two sections

88
Q

First section contains already sorted elements

89
Q

The second contains the unsorted elements

90
Q

At the beginning the section that contains the sorted elements is empty

91
Q

And the section with the unsorted elements is the entire array

92
Q

The algorithm finds the smallest element ( or largest depending on sorting order) in the unsorted section and exchanges it with the leftmost element in the unsorted section

93
Q

uggest a suitable algorithm to solve a specific problem

95
Q

Efficiency: amount of the computer resources required to perform its functions. Minimizing the use of various resources such as the CPU and memory is important.

96
Q

Correctness: the extent to which the algorithm satisfies its specification

A

free from fault

97
Q

Reliability: refers to the capability of the algorithm to maintain a predefined level of performance

98
Q

Flexibility: effort required to modify the algorithm for other purposes