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!
Write an algorithm for binary search. Algorithm for Binary Search
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]
The space-complexity of the algorithm is a constant. It just needs space of three integers m, n and t. Thus, the space complexity is O(1). The time complexity based on the loop
This notation gives an upper bound for a function to within a constant factor. Given Figure illustrates the plot of f(n) = O(g(n)) depend on big O notation. We write f(n) = O(g(n))
Complexity of an Algorithm An algorithm is a sequence of steps to solve a problem; there may be more than one algorithm to solve a problem. The choice of a particular algorith
1. What is an expert system and where are they needed? 2. What are the major issues involved in building an expert system?
Q. Draw a B-tree of order 3 for the sequence of keys written below: 2, 4, 9, 8, 7, 6, 3, 1, 5, 10
A spanning tree of any graph is only a subgraph that keeps all the vertices and is a tree (having no cycle). A graph might have many spanning trees. Figure: A Graph
sdsd.
state difference between linear and non linear data structure. give one example scenario of each
Limitation of Binary Search: - (i) The complexity of Binary search is O (log2 n). The complexity is similar irrespective of the position of the element, even if it is not pres
Determine the precondition of a binary search For instance, precondition of a binary search is that array searched is sorted however checking this precondition is so expensive
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