second highest number in a given set of numbers
Answers were Sorted based on User's Feedback
Answer / kartik
Read the set of numbers in to an array ,sort it using bubble
sort(ascending order logic),the last but one number wil be
second highest number.....
| Is This Answer Correct ? | 9 Yes | 4 No |
Answer / suriya
put all nos. in an array and sort it using selection sort in
ascending order the last no. will be the second highest no.
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / om
There are two good method to solve this problem; first one
takes 2n-3 comparison and second one takes n+lg(n)-2
comparison only.
1) Run bubble sort loop only for 2 times ..the first time it
will do n-1 comparison and put the largest element at the
end of the array.... then by running second time it will do
n-2 comparison and put the second largest element at the
second last position in the array... so n-1 + n-2 =2n-3
comparison. cool naa... I didn't sort the whole array and
found the second largest element.
2)http://www.seeingwithc.org/topic3html.html
check this site...
| Is This Answer Correct ? | 2 Yes | 1 No |
What is c token?
What is c programing language?
What are .h files and what should I put in them?
What is c language & why it is used?
FILE PROGRAMMING
How can I access a memory located at certain address?
What is the correct code to have following output in c using nested for loop?
what is the use of bitfields & where do we use them?
void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?
what is the difference between structure and union?
Is c still used?
prototype of sine function.