What are the average number of comparisons required to sort
3 elements?

Answers were Sorted based on User's Feedback



What are the average number of comparisons required to sort 3 elements?..

Answer / jaiprakash

n(n-1)/2(bubble sort)
n=3
(3*2)/2=3(n)

ans:n

Is This Answer Correct ?    13 Yes 1 No

What are the average number of comparisons required to sort 3 elements?..

Answer / hell2heaven

I think answer is 3.is it right?

Is This Answer Correct ?    12 Yes 1 No

Post New Answer

More C Interview Questions

Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

0 Answers   TATA, TCS,


Can I pass constant values to functions which accept structure arguments?

2 Answers  


How can I read data from data files with particular formats?

0 Answers  


how to swap two nubers by using a function with pointers?

1 Answers  


Write a program using bitwise operators to invert even bits of a given number.

2 Answers  






What is an identifier?

0 Answers  


What does c mean before a date?

0 Answers  


Given an array of characters, how would you reverse it? How would you reverse it without using indexing in the array?

1 Answers   Microsoft,


Tell me what is null pointer in c?

0 Answers  


to convert a string without using decrement operater and string functions

1 Answers  


int i=~0; uint j=(uint)i; j++; printf(“%d”,j);

1 Answers  


64/square(4)

1 Answers  


Categories