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



should we use linear search or binary search if elements are placed in random order or mixed?in bo..

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

should we use linear search or binary search if elements are placed in random order or mixed?in bo..

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

Post New Answer

More OOPS Interview Questions

i got a backdoor offer in process global,Bangalore..Can i work with it?

0 Answers  


what is the new version of oops

0 Answers   Ignou,


What is abstraction and encapsulation?

0 Answers  


what is SPL in c++.

1 Answers  


c++ provides classes...and classes do what we want but why then strcut are used...if we say data hiding... it is also provided by c++ in structs then why to prefer clasess

1 Answers   HCL, TCS,






What is function overloading and operator overloading?

4 Answers  


Who invented oop?

0 Answers  


create a c++ program that will accepts 9 inputs using 3 by 3 array.

1 Answers  


explain dynamic binding by drowing

2 Answers   Cognizant,


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

0 Answers   TCS,


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

2 Answers  


Write a program to reverse a string using recursive function?

0 Answers   TCS,


Categories