ADS
From the given example, find a value placed at index '2'. Given: hash(x)= x %(mod) 10
12
Given a hash table T with 25 slots that stores 3000 elements, the load factor α for T is
120
From the given example, find index of '12'. Given: hash(x)= x %(mod) 10
2
How many sub arrays does the quick sort algorithm divide the entire array into at each iteration?
2
What is a hash function?
A function that computes the location of the key in the array
Which of the following is required to apply Binary Search algorithm?
Array must be sorted in ascending order
If several elements are competing for the same bucket in the hash table, what is it called?
Collision
Which of the following algorithm design technique is used in merge sort?
Divide and Conquer
Whаt аlgorithm is dеscribеd bеlow? 1. аdd thе еlеmеnt to thе bottom lеvеl of thе hеаp аt thе most lеft. 2. Compаrе thе аddеd еlеmеnt with its pаrеnt; if thеy аrе in thе corrеct ordеr, stop. 3. If not, swаp thе еlеmеnt with its pаrеnt аnd rеturn to thе prеvious stеp
Insеrtion to а hеаp
What searching algorithm starts at the beginning of the list and check every element in the list?
Linear search
Which of the following sorting algorithms has the lowest worst-case complexity?
Merge Sort
What is the best time complexity of bubble sort?
N
Given a sorted array of integers, what can be the minimum worst case time complexity to find ceiling of a number x in given array? Ceiling of an element x is the smallest element present in array which is greater than or equal to x. Ceiling is not present if x is greater than the maximum element present in array. For example, if the given array is {12, 67, 90, 100, 300, 399} and x = 95, then output should be 100.
O(Logn)
the run time for traversing all the nodes of a binary search tree with n nodes and printing them in an order is
O(n)
What is the best sorting algorithm to use for the elements in array are more than 1 million in general?
Quick sort
What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?
Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
Whаt аlgorithm is dеscribеd bеlow?
Rеmoving thе root from а hеаp
The average case occurs in the Linear Search Algorithm when:
The item to be searched is in some where middle of the Array
Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this: 2 5 1 7 9 12 11 10
The pivot could be either the 7 or the 9.
How to get an index of list (chain) from the hash code of a HashTable Node (M - number of chains/bins)
Using modulo operator (hashcode % M)
Is it possible for a binary search tree to become unbalanced?
Yes
Which of the following statements about Linear Search is TRUE?
a. linear search compares each array element with a search key. b. it's just as likely that the value will be found in the first element as the last. c. In order to check if a value is not in the array, the algorithm must compare the search key to every element in the array. d. on average, the algorithm must compare the search key with half the array elements.
Which of the following data structures is non-linear?
trees