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


Please Help Members By Posting Answers For Below Questions

Explain the array representation of a binary tree in C.

728


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

1644


How is a macro different from a function?

656


What is the difference between strcpy() and memcpy() function in c programming?

626


How do you convert strings to numbers in C?

710






What is dynamic dispatch in c++?

558


What is the difference between test design and test case design?

1570


Explain what does the format %10.2 mean when included in a printf statement?

782


What does stand for?

598


Dont ansi function prototypes render lint obsolete?

604


What is wrong with this statement? Myname = 'robin';

821


How are structure passing and returning implemented?

589


Explain heap and queue.

589


What are local static variables? How can you use them?

647


What is the use of typedef in structure in c?

546