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 |
How is a structure member accessed?
What will be the result of the following C language program? main() { int a = 0; int b = 20; char x = 1; char y = 10; if(a,b,x,y) printf("Welcome"); }
Can you apply link and association interchangeably?
What are runtime error?
Explain is it better to bitshift a value than to multiply by 2?
What is define c?
What is c programing language?
What is the mean of this statement:: if(int i=0 * i=9)
What is actual argument?
3. When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
What is the size of a union variable?