CSE 310 Midterms 1 and 2

Ace your homework & exams now with Quizwiz!

The 5-step algorithm SELECT(A, k) for determining the kth smallest element of array A of size n has an O(n) complexity when the group size is 3.

False

The height of any binary search tree with n nodes is O(logn)

False

The only value A that works for the hash function h(k) = [r.d. m (kA mod 1) ]r.d. is A = (√5 - 1)/2

False

True or false: RBT is a balanced BST so that the max height difference between levels can be 2

False

True or false: the following array is a max heap: [10, 3, 5, 1, 4, 2]

False

Which of the following recursive algorithms can be solved using master theorem? a) T(n) = 2(T(n/3) + theta(1) b) T(n) = 3 T(n/3) - n c) T(n) = 2T(n/6) + T(n/3) + n d) None of the above e) All of the above

a) T(n) = 2(T(n/3) + theta(1)

Which of the following statements is NOT true about heap-sort? a) Heap sort is an "in-place" sorting algorithm b) Heap sort uses the complete-binary representation c) Heap sort uses an array to store data d) Running time of the heap-sort is O(n^2)

d) Running time of heap-sort is O(n^2)

The worst case running tie of quick sort happens the array is a) Sorted b) Reverse-sorted c) All the elements of the array are same d) A and B e) A, B, and C

e) A, B, and C

What is the worst-case insertion time of a BST?

n

Any given sorting algorithm that sorts int key values, the best possible asymptotic running time is

nlog(n)

What data structure has guaranteed log (n) time for insert, delete, and search operations?

?????? who tf knows

Which of the following sorting algorithm can have guaranteed O(nlogn) ruling time? a) Merge sort b) Quick sort c) Heap sort d) Both B and C

Answer unclear?????

Which of the following is true of finding kth smallest element in an unsorted array? a) the best running time in finding kth smallest is log(n) as we can use the recursion b) the best running time in finding kth smallest is n log(n) c) the bestr unning time in finding kth smallest is n d) first, we can sort it and ten find the kth position. That will take nlon(n) time in the best case.

C

In Open Addressing, the loading factor is always ≤ 1.

True

True or false: If a node in a binary search tree has two children, its successor cannot have left child.

True


Related study sets

POSHER PRAMS and sentence types for Paper 1, Question 2

View Set

Tagalog - 625 Most Important Words - By Category

View Set

4.3.1: Understanding the Natural Rate of Unemployment

View Set

ADMF 102 Material Quality Control Quiz Answers

View Set

Pathology of Alcoholic and Non-alcoholic liver disease

View Set