should we use linear search or binary search if elements
are placed in random order or mixed?in both cases? i need a
little bit detail ans?thnks
Answers were Sorted based on User's Feedback
Answer / indira
We have to use Linear Search only when elms r in random or
mixed .
In order to use Binary Search u have to sort these elems
whose order of complexity is n2.
so its better to use linear search whose complexity is of o(n)
| Is This Answer Correct ? | 14 Yes | 1 No |
Answer / pavan
binary search tecqnique is applicable only to sorted
elements because we find the mid value and then cmp it with
the key and if the key is greater than the mid value then
we scan on towards the right else towards the left
so,hencefort itwe should make use of linear search when the
elements r not sorted
| Is This Answer Correct ? | 8 Yes | 0 No |
what is the difference between class and structure in C++?
Why do we use class in oops?
what is abstract class ? when is used in real time ? give a exp
What is the different between Applet and Application?
What is encapsulation process?
i am getting an of the type can not convert int to int *. to overcome this problem what we should do?
what is mean by design pattern
Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)
Child cObj = new Parent() Wahts the output ?
Define a class to represent a bank account. Include the following members: Data Members: Name of the Depositor Account Number Type of Account Balance amount in the account Member Functions: To assign the initial values. To deposit an account. To withdraw an amount after checking the balance. Write a C++ main program to display account number, name and balance.
Why many objects can working together? How objects working togetherM I want to see example code.
What is the difference between declaration and definition?