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..

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..

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

More OOPS Interview Questions

Where You Can Use Interface in your Project

who is the father of OPPS

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?

What is the difference between declaration and definition?

What is the difference between a mixin and inheritance?

whats the difference between c and c++

Why polymorphism is used in oops?

What is a friend function & its advantage?

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

What is the difference between abstraction and polymorphism?

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

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

Categories