1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision
Answer Posted / sachin
1.#include<stdio.h>
int main()
{
int a[10]={222,111,4,5,6,8,1,77,0,4};
int i=0,max=0,sec_max=0;
for(i=0;i<10;i++)
{
if(a[i]>max)
{
sec_max=max;
max=a[i];
}
else if(a[i]>sec_max)
{
sec_max=a[i];
}
}
printf("Max= %d Second Max=%d",max,sec_max);
}
| Is This Answer Correct ? | 23 Yes | 2 No |
Post New Answer View All Answers
hi send me sample aptitude papers of cts?
What is the value of uninitialized variable in c?
how to construct a simulator keeping the logical boolean gates in c
Where define directive used?
In C language, a variable name cannot contain?
How can you call a function, given its name as a string?
Explain the priority queues?
What is the use of c language in real life?
What are the Advantages of using macro
What is a pointer in c plus plus?
Explain how do you declare an array that will hold more than 64kb of data?
What are the advantages of using linked list for tree construction?
What is the use of pointers in C?
What is difference between constant pointer and constant variable?
How can I run c program?