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 |
Write a program to check armstrong number in c?
what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x",I); } give detailed reason
Give basis knowledge of web designing ...
write a function that accepts an array A with n elements and array B with n-1 elements. Find the missing one in array B,with an optimized manner?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
#include<stdio.h> #include<conio.h> void main() { clrscr(); int a=0,b=0,c=0; printf("enter value of a,b"); scanf(" %d %d",a,b); c=a+b; printf("sum is %d",c); getch(); }
Why we use stdio h in c?
wat is the difference between array and pointer?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Explain what are compound statements?
Explain the red-black trees?
Why header file is used in c?