Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > What the fastes...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 20 Topic 25865 of 27670
Post > Topic >>

What the fastest algorithm for find max/min in an array of integers?

by Eugeny Myunster <box@[EMAIL PROTECTED] > Apr 24, 2008 at 11:28 PM

I know, only simple one:

#include <stdio.h>

int main()
{
	int min=0,max=0,i,arr[12];
	for(i=0;i<12;i++)
		arr[i]=rand()%31-10;
	for(i=0;i<12;i++)
		printf("%d\t",arr[i]);
	printf("\n");		
	for(i=0;i<12;i++)
	{
		if(arr[max]<arr[i])
			max=i;
	}
	for(i=0;i<12;i++)
	{
		if(arr[min]>arr[i])
			min=i;
	}
	printf("\nmax is: %d\n",arr[max]);		
	printf("\nmin is: %d\n",arr[min]);	

	return 0;
}
 




 20 Posts in Topic:
What the fastest algorithm for find max/min in an array of integ
Eugeny Myunster <box@[  2008-04-24 23:28:18 
Re: What the fastest algorithm for find max/min in an array of i
richard@[EMAIL PROTECTED]  2008-04-24 22:13:13 
Re: What the fastest algorithm for find max/min in an array of i
Don Bruder <dakidd@[EM  2008-04-24 15:56:05 
Re: What the fastest algorithm for find max/min in an array of i
Keith Thompson <kst-u@  2008-04-24 16:20:39 
Re: What the fastest algorithm for find max/min in an array of i
richard@[EMAIL PROTECTED]  2008-04-24 23:48:00 
Re: What the fastest algorithm for find max/min in an array of
user923005 <dcorbit@[E  2008-04-24 18:33:09 
Re: What the fastest algorithm for find max/min in an array of
flydream <smthflydream  2008-04-24 19:21:08 
Re: What the fastest algorithm for find max/min in an array of
user923005 <dcorbit@[E  2008-04-24 19:53:08 
Re: What the fastest algorithm for find max/min in an array of
Willem <willem@[EMAIL   2008-04-25 06:47:55 
Re: What the fastest algorithm for find max/min in an array of
James Harris <james.ha  2008-04-25 12:31:03 
Re: What the fastest algorithm for find max/min in an array of
James Harris <james.ha  2008-04-25 11:33:25 
Re: What the fastest algorithm for find max/min in an array of
James Harris <james.ha  2008-04-25 17:35:30 
Re: What the fastest algorithm for find max/min in an array of
user923005 <dcorbit@[E  2008-04-25 18:37:09 
Re: What the fastest algorithm for find max/min in an array of
James Harris <james.ha  2008-04-26 15:22:17 
Re: What the fastest algorithm for find max/min in an array of
user923005 <dcorbit@[E  2008-04-28 12:24:20 
Re: What the fastest algorithm for find max/min in an array of
Ben Bacarisse <ben.use  2008-04-26 00:44:24 
Re: What the fastest algorithm for find max/min in an array of
"Dann Corbit" &  2008-04-25 18:19:51 
Re: What the fastest algorithm for find max/min in an array of i
"Dann Corbit" &  2008-04-24 13:44:57 
Re: What the fastest algorithm for find max/min in an array of
Harald van =?UTF-8?b?RMSz  2008-04-26 18:47:01 
Re: What the fastest algorithm for find max/min in an array of
Ben Bacarisse <ben.use  2008-04-26 18:28:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 22:04:52 CDT 2008.