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


Please Help Members By Posting Answers For Below Questions

What is a method in c?

628


How pointer is different from array?

579


What does it mean when a pointer is used in an if statement?

602


Mention four important string handling functions in c languages .

630


What is the use of function overloading in C?

678






How do you search data in a data file using random access method?

831


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

1633


What are the rules for the identifier?

671


Why do we use header files in c?

582


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

603


How are variables declared in c?

599


What is d scanf?

595


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

3661


Is null equal to 0 in sql?

655


What are the uses of a pointer?

683