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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the example of polymorphism?

550


What is inheritance write a program to show use of inheritance?

603


INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?

1625


Can a varargs method be overloaded?

611


State what is encapsulation and friend function?

687






What are the types of abstraction?

546


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

1634


Why polymorphism is used in oops?

575


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6131


2. Give the different notations for the class.\

1576


What is encapsulation c#?

593


How do you answer polymorphism?

569


What is balance factor?

572


How to hide the base class functionality in Inheritance?

628


How do you use inheritance in unity?

577