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

A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

662


What are the scope of static variables?

597


Can you please explain the scope of static variables?

597


Explain the difference between strcpy() and memcpy() function?

584


Explain what’s a signal? Explain what do I use signals for?

606






Find MAXIMUM of three distinct integers using a single C statement

622


Explain enumerated types in c language?

600


Differentiate abs() function from fabs() function.

588


Which is better between malloc and calloc?

664


What is an lvalue?

627


What is the equivalent code of the following statement in WHILE LOOP format?

761


How can I determine whether a machines byte order is big-endian or little-endian?

615


What are called c variables?

569


What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

583


Explain bitwise shift operators?

627