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

When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory??

13 Answers   HCL, Honeywell,


how to find the largest of given numbers in an array

2 Answers  


What does the keyword "static" mean?

4 Answers   TCS,


What is balance factor?

0 Answers  


what are abstract classes and how they impliment , with example

2 Answers  






Whats is abstraction in oops?

0 Answers  


What is oops and its features?

0 Answers  


What is and I oop mean?

0 Answers  


What is abstraction encapsulation?

0 Answers  


c++ is a pure object oriented programming or not?

5 Answers   Wipro,


Write a c++ program to display pass and fail for three student using static member function

0 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,


Categories