What is the average number of comparisons in a sequential
search?

Answer Posted / vivek tiwari

f(n)= 1.Pn + 2.Pn + 3.Pn +...+ N.Pn
where
Pn = 1/N
f(n)= 1.1/N +2.1/N + 3.1/N+....+N.1/N
= (1+2+3+....+N)1/N
= N(N+1)/2N
= (N+1)/2

Is This Answer Correct ?    47 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the impact of signed numbers on the memory?

531


Why null is not allowed in treemap?

494


Explain binary searching and Fibinocci search?

561


What is a queue in data structure?

533


What is the difference between push and pop?

601






What is the Difference between sax and dom parser?

567


what are the applications that use Linked lists?

514


What is top in stack?

448


What are skew trees? For a tree with 4 nodes draw all possible binary? Generalize for n nodes how many binary trees can be drawn?

627


Can we override compareto method for enumerations?

579


How are elements stored in hashset?

465


Why do we use different types of data structures?

473


What is difference between arraylist and linkedlist?

546


What is Jagged Arrays?

551


How do you explain bubble sort?

487