1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision
Answer Posted / abdur rab
#include <stdio.h>
int main ( int argc, char* argv[] )
{
int* array_int, nTotalCount = 10, sbig, big, i;
printf ( "\n/********************** Second Biggest
Number ********************/" );
array_int = ( int* ) malloc ( nTotalCount * sizeof
( int ) );
for ( i = 0; i < nTotalCount; i++ )
array_int [i] = rand() % 100;
printf( "\nThe Numbers in given order" );
for ( i = 0; i < nTotalCount; i++ )
printf ( "\t%d", array_int [i] );
for ( i = 0; i < nTotalCount; i++ )
{
switch ( i )
{
case 0:
sbig = big = array_int [i];
break;
default:
if ( big < array_int [i] ) {
sbig = big;
big = array_int [i];
} else {
if ( sbig <
array_int [i] ) sbig = array_int [i] ;
}
break;
}
}
printf ( "\n sbig :%d big :%d", sbig, big );
free ( array_int );
}
For hashtable please refer the following link
http://www.geocities.com/abdur_rab7/Open_Hash/openhash.html
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What are the 4 data types?
When the macros gets expanded?
What is a void pointer in c?
What is the -> in c?
Explain which function in c can be used to append a string to another string?
Add Two Numbers Without Using the Addition Operator
Explain what are global variables and explain how do you declare them?
The file stdio.h, what does it contain?
What are pointers really good for, anyway?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
The statement, int(*x[]) () what does in indicate?
What is a string?
Can you please explain the difference between exit() and _exit() function?
Explain how does free() know explain how much memory to release?
Why ca not I do something like this?