Important alert: (current site time 12/20/2014 9:39:39 AM EDT) They're finally here! Check out our new 7 Source Code CDs!

# Maximum and Minimum using Divide and Conquer

Email
 Submitted on: 4/16/2009 8:32:07 AM By: Y. Jayarathina Madharasan Level: Beginner User Rating: By 2 Users Compatibility: C Views: 23168

Find the maximum and minimum of elements using Divide and Conquer

code:
Can't Copy and Paste this?
 Terms of Agreement:    By using this code, you agree to the following terms...    You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.    You may link to this code from another website, but ONLY if it is not wrapped in a frame.  You will abide by any additional copyright restrictions which the author may have placed in the code or code's description. ``` //************************************** // Name: Maximum and Minimum using Divide and Conquer // Description:Find the maximum and minimum of elements using Divide and Conquer // By: Y. Jayarathina Madharasan // //This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=12673&lngWId=3//for details.//************************************** // By madharasan.com #include int max, min; int a[100]; void maxmin(int i, int j) { int max1, min1, mid; if(i==j) { max = min = a[i]; } else { if(i == j-1) { if(a[i] min1) min = min1; } } } void main () { int i, num; clrscr(); printf ("\n\t\t\tMAXIMUM & MINIMUM\n\n"); printf ("\nEnter the total number of numbers : "); scanf ("%d",&num); printf ("Enter the numbers : \n"); for (i=1;i<=num;i++) { scanf ("%d",&a[i]); } max = a[0]; min = a[0]; maxmin(1, num); printf ("Maximum element in an array : %d\n", max); printf ("Minimum element in an array : %d\n", min); getch(); }```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)