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 |
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??
how to find the largest of given numbers in an array
What does the keyword "static" mean?
What is balance factor?
what are abstract classes and how they impliment , with example
Whats is abstraction in oops?
What is oops and its features?
What is and I oop mean?
What is abstraction encapsulation?
c++ is a pure object oriented programming or not?
Write a c++ program to display pass and fail for three student using static member function
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