8. Algorithm Case Study

Beschreibung

Algorithms and Data Structures | Test 3 Review | CSCI-3110-002 MTSU
Mena Sargios
Quiz von Mena Sargios, aktualisiert more than 1 year ago
Mena Sargios
Erstellt von Mena Sargios vor mehr als 7 Jahre
23
0

Zusammenfassung der Ressource

Frage 1

Frage
Binary search works on both sorted and non-sorted arrays.
Antworten
  • True
  • False

Frage 2

Frage
With Sequential search having an average O(N) and Binary search having an average O(logN), Which is quicker to use?
Antworten
  • Binary search
  • none of the above

Frage 3

Frage
When dividing a list in twos what do you do when its not evenly divided by power of 2?
Antworten
  • A.take the lowest value of 2 you can find
  • B,find the the numbers that its inbetween
  • C,take the power of 2 that higher then it
  • D.none of the above

Frage 4

Frage
Any linear ordering of all of the vertives in which all the arrows go to the right that is a valid solution.
Antworten
  • True
  • False

Frage 5

Frage
if doing a sequential search what is the worst case in terms of big O ?
Antworten
  • A)O(n)
  • B)O(log n)
  • C)O(1)
  • D)O(n/2)

Frage 6

Frage
Under what condition would the big O for binary search be 1 + log_2(n)?
Antworten
  • a. n is not a power of two
  • b. the array is not sorted.
  • c. this would never be the big O
  • d. none of the above

Frage 7

Frage
What is the worst-case number of iterations for binary search?
Antworten
  • A) O(log_2 n)
  • B) O(2 log_2 n)
  • C) O(n^2)
  • D) O(n)

Frage 8

Frage
Sequential(Linear) search may be more suited to keep the array sorted if the user inserts more items than searching for them.
Antworten
  • True
  • False

Frage 9

Frage
What is the worst case for a sequential search?
Antworten
  • A. O(N^2)
  • B. O(N)
  • C. O(N/2)
  • D. O(logN)

Frage 10

Frage
What is a sequential search?
Antworten
  • A) A search that loops through a list and stops if the item is found
  • B) Using a sorted array, a search that iteratively divides the search partition in half. It looks at the middle element and has three scenarios.
  • C) None of the above.

Frage 11

Frage
The worst case for the second algorithm shown during the case study video is:
Antworten
  • A. O(n)
  • B. O(n log n)
  • C. O(log n)
  • D. O(n^2)

Frage 12

Frage
Which is true of a sequential search and a binary search?
Antworten
  • A. A sequential search needs to be sorted and a binary search does not need to be sorted.
  • B. A sequential search does not need to be sorted and a binary search needs to be sorted.
  • C. Both sequential and binary searches need to be sorted.
  • D. Neither a sequential nor a binary search needs to be sorted.

Frage 13

Frage
When dealing with smaller numbers of n sequential searching and binary search do not have much difference with growth rate. It is until n gets into the 1000’s that the difference becomes greater.
Antworten
  • True
  • False

Frage 14

Frage
The following description of sequential search is T/F ? sequential search: loops through a list and stops if the item is found worst-case is O ( N ) average-case is O ( N/2 ) = O ( N ) best case is O ( 1 )
Antworten
  • True
  • False

Frage 15

Frage
If you have a sorted array, which searching alogrithm is better binary or sequential?
Antworten
  • Sequential
  • Binary
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

2. Red Black Tree
Mena Sargios
12. Graph Traversal
Mena Sargios
5. B-Tree
Mena Sargios
3. 2-3 Tree
Mena Sargios
7. Algorithm Growth Rate
Mena Sargios
16. Greedy Algorithm (Huffman code)
Mena Sargios
4. 2-3-4 Tree
Mena Sargios
1. Trees Splay Trees
Mena Sargios
10. Hashing Collision
Mena Sargios
14. Graph Shrtest Path
Mena Sargios
15. Graph Spanning Tree
Mena Sargios