1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision
Answer Posted / jaypal rajput
//find second maximum number in given array.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[5];
int max=0,secmax=0,i;
cout<<"Enter element";
for(i=0;i<=4;i++)
{
cin>>a[i];
}
for(i=0;i<=4;i++)
{
if(a[i]>max)
{
secmax=max;
max=a[i];
}
if(a[i]>secmax&&a[i]<max)
{
secmax=a[i];
}
}
cout<<"The max element is="<<max;
cout<<"the sec max is="<<secmax;
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What does the function toupper() do?
How does normalization of huge pointer works?
What is a volatile keyword in c?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
What is ## preprocessor operator in c?
Explain why c is faster than c++?
How do you print an address?
How do you determine the length of a string value that was stored in a variable?
Why is void main used?
What is a pointer value and address in c?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What are the different types of control structures in programming?
What are Macros? What are its advantages and disadvantages?
Explain what is the concatenation operator?
What are the 4 data types?