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 |
Why static functions always uses static variables?
what is diff between .net 1.1 and .net 2.0
where is memory for struct allocated? where is memory for class-object allocated? I replied for struct in stack and for class-object in heap. THen he asked if class has struct member variable what happens.class on heap and what about struct in that class? couldnt ans :( :-?
Write A Program using Single and Multiple Inheritance.
design class for linked list and include constructor,destructor,insert option. struct node { int node; struct node &ptr; }
who is the founder of c++?
Program to open a file with First argument
what is the function of 'this' operator ?
what is the difference between class to class type conversion and copy constructor ?
Get me a number puzzle game-program
class type to basic type conversion
what is difference between thread and programme.