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

Can a varargs method be overloaded?

617


Explain the concepts involved in Object Oriented programming.

642


What is the main purpose of inheritance law?

673


Why is there no multiple inheritance?

571


what is the 3 types of system development life cycle

2435






Which language is pure oop?

551


What is protected in oop?

604


Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

2008


Why do we use class in oops?

555


What is byval and byref? What are differences between them?

1691


Why do we use polymorphism in oops?

583


What is the highest level of cohesion?

581


What is the importance of oop?

613


Why polymorphism is used in oops?

585


What is the purpose of enum?

583