Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Write down the algorithm for binary search. Which are the conditions under which sequential search of a list is preferred over the binary search?
Ans.
Algorithm for the Binary Search is as follows
1. if (low> high)
2. return (-1)
3. Mid = (low + high)/2
4. if ( X = = a[mid])
5. return (mid);
6. if (X < a[mid])
7. search for X in a[low] to a[mid-1]
8. else
9. search for X in a[mid+1] to a[high]
Sequential Search is preferred over the binary search when the list is disorder and haphazardly constructed. When searching is to be done on unsorted list then linear search is the only option.
State the example of pre- and post-conditions Suppose that function f(x) should have a non-zero argument and return a positive value. We can document these pre- and post-condit
Full Binary Trees: A binary tree of height h that had 2h -1 elements is called a Full Binary Tree. Complete Binary Trees: A binary tree whereby if the height is d, and all of
One of the best known methods for external sorting on tapes is the polyphase sort. Principle: The basic strategy of this sort is to distribute ordered initial runs of predetermi
Describe an algorithm to play the Game of Nim using all of the three tools (pseudocode, flowchart, hierarchy chart)
Illustrate Trivariate Colour Models Conventional colour models based on the tristimulus theory all contain three variables and so are called trivariate models. Let us now consi
Midsquare Method :- this operates in 2 steps. In the first step the square of the key value K is taken. In the 2nd step, the hash value is obtained by deleting digits from ends of
What is an Algorithm? An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for getting a needed output for any legitimate input in a finite amoun
A Binary Search Tree is binary tree which is either empty or a node having a key value, left child & right child. By analyzing the above definition, we notice that BST comes int
A B-tree of minimum degree t can maximum pointers in a node T pointers in a node.
Explain in detail the algorithmic implementation of multiple stacks.
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd