Category: Data Structure
-
Define hash function?
Hash function takes an identifier and computes the address of that identifier in the hash table using some function.
-
What is Binary search?
A binary search, also called a dichotomizing search, is a digital scheme for locating a specific object in a large set. Each object in the set is given a key. The number of keys is always a power of 2. If there are 32 items in a list, for example, they might be numbered 0…
-
What is linear search?
In Linear Search the list is searched sequentially and the position is returned if the key element to be searched is available in the list, otherwise -1 is returned. The search in Linear Search starts at the beginning of an array and move to the end, testing for a match at each item.
-
Define Searching.
Searching for data is one of the fundamental fields of computing. Often, the difference between a fast program and a slow one is the use of a good algorithm for the data set. Naturally, the use of a hash table or binary search tree will result in more efficient searching, but more often than not…
-
Compare quick sort and merge sort.
Quicksort has a best-case linear performance when the input is sorted, or nearly sorted. It has a worst-case quadratic performance when the input is sorted in reverse, or nearly sorted in reverse. Merge sort performance is much more constrained and predictable than the performance of quicksort. The price for that reliability is that the average…
-
Mention the different ways to select a pivot element.
The different ways to select a pivot element are
-
What is the output of quick sort after the 3rd iteration given the following sequence?
24 56 47 35 10 90 82 31 Pass 1:- (10) 24 (56 47 35 90 82 31) Pass 2:- 10 24 (56 47 35 90 82 31) Pass 3:- 10 24 (47 35 31) 56 (90 82)
-
Which of the following sorting methods would be especially suitable to sort alist L consisting of a sorted list followed by a few “random” elements?
Quick sort is suitable to sort a list L consisting of a sorted list followed by a few “random” elements.
