MinMax

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

Search

 

Search DelphiForFun.org only

Support DFF

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

 

If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.

In Association with Amazon.com

 

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

 

Search DelphiForFun.org only

 

 

 

 

 

The Problem

Arrange N x N apples (for example: 9 or 16 or 25) in a square with N rows and N columns.  From each row find the largest one and call the smallest of these  "A".   From each column find the smallest and let "B" be the largest of these.  Which apple is bigger, A or B?   (Or are they always the same, or could it be either one?)

BackGround and Techniques

Here's a simple little problem without much math involved.  Trying to solve it in your head can  cause minor headaches though.  

Simple code - we just do what the problem says.  But it  does give us the chance to introduce usage of StringGrids   (TStringGrid in  Delphi terms - all components begin with the letter "T" to indicate that this is a "type" definition).   

One neat touch here is to use  an "OwnerDrawCell"  event exit to draw the cells so that the smallest of the row max's and the largest of the column min's can be highlighted.

Running/Exploring the Program 

Suggestions for Further Study

Not much else to do with this one.  Make sure you understand the code and then let's move on to bigger and better things!

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2010, Gary Darby    All rights reserved.