Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Where You Can Use Interface in your Project

0 Answers   KPIT,


who is the father of OPPS

4 Answers   Infosys, TCS,


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

0 Answers  


What is the difference between declaration and definition?

20 Answers   IBS,


What is the difference between a mixin and inheritance?

0 Answers  






whats the difference between c and c++

7 Answers   Syntel,


Why polymorphism is used in oops?

0 Answers  


What is a friend function & its advantage?

2 Answers   TCS,


4. What do you mean by a prototype? Define analysis prototype

1 Answers  


What is the difference between abstraction and polymorphism?

0 Answers  


What is the difference between pass by value,pass by pointer,pass by reference in the catch block in the exception handling in c++

1 Answers   TCS,


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

2 Answers  






Categories