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

What does sizeof function do?

608


Why is c called "mother" language?

851


What do you mean by dynamic memory allocation in c? What functions are used?

647


What are structural members?

564


What are file streams?

562






How do you define CONSTANT in C?

647


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7385


What is size of union in c?

578


How do I use strcmp?

632


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3331


What is an array in c?

589


Can you define which header file to include at compile time?

582


what are # pragma staments?

1621


What happens if header file is included twice?

650


What is %d used for?

580