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 is the use of a conditional inclusion statement in C?

709


write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...

1581


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

715


which type of aspect you want from the student.

1793


Difference between goto, long jmp() and setjmp()?

822






How can I recover the file name given an open stream or file descriptor?

699


Mention four important string handling functions in c languages .

734


What are structures and unions? State differencves between them.

712


What is the ANSI C Standard?

873


How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?

701


Is c is a middle level language?

696


How can I write functions that take a variable number of arguments?

720


program for reversing a selected line word by word when multiple lines are given without using strrev

2050


Is that possible to add pointers to each other?

998


What are structure types in C?

762