Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

find second largest element in array w/o using sorting
techniques? use onle one for loop.

Answer Posted / guest


max = 2ndmax= array[0];
for (i=0;i,length;i++)
{
if (array[i]>max)
{
2ndmax=max;
max=array[i];
}
}
return 2nd max

Is This Answer Correct ?    40 Yes 74 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I get an accurate error status return from system on ms-dos?

1175


Write a program for Overriding.

1210


What are 'near' and 'far' pointers?

1088


What is difference between structure and union in c?

1035


What does the file stdio.h contain?

1119


What are the advantages and disadvantages of a heap?

1258


Explain what are preprocessor directives?

1125


When is a void pointer used?

1307


What is a pointer variable in c language?

1152


What does it mean when a pointer is used in an if statement?

1153


to find the closest pair

2370


int far *near * p; means

3621


What is class and object in c?

1173


How can I call a function with an argument list built up at run time?

1285


Can you return null in c?

1229