From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,af4868d4b196fa50 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.182.6 with SMTP id ea6mr2930823wic.4.1367666133286; Sat, 04 May 2013 04:15:33 -0700 (PDT) Path: hg5ni66856wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!backlog2.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 30 Apr 2013 09:56:17 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Breadth First Search Missionaries and Cannibals References: <6c3bb45c-6cb1-4609-9c3f-c3f01c545eac@googlegroups.com> In-Reply-To: <6c3bb45c-6cb1-4609-9c3f-c3f01c545eac@googlegroups.com> Message-ID: <517f7917$0$9507$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 30 Apr 2013 09:56:07 CEST NNTP-Posting-Host: d9858d8f.newsspool1.arcor-online.net X-Trace: DXC=omTAZi9ZlgoeoCI^f\Y]Eaic==]BZ:afn4Fo<]lROoRankgeX?EC@@`[A^MO;>XjJgnc\616M64>jLh>_cHTX3jmaV8AOcd4^4c X-Complaints-To: usenet-abuse@arcor.de X-Original-Bytes: 2618 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2013-04-30T09:56:07+02:00 List-Id: On 30.04.13 04:48, Alex wrote: > Given the following Function signature how would I go about using breadth first search to find out the minimum number of trips it would take to get all the missionaries and cannibals across the river. *MUST USE BREADTH FIRST SEARCH* If you are not familiar with the problem see the wiki page here : > > http://en.wikipedia.org/wiki/Missionaries_and_cannibals_problem > > The only difference between the problem in the wiki article is in this one the number of missionaries and cannibals and the number of people the boat can hold can change. > > M is missionaries, C is cannibals and R is the number of people you can fit in the boat. > > function Min_Crossings(M, C, R : Integer) return Integer is > -- you can assume M, C, and R are all >= 2 and C <= M While this does not address the combinatorial part, if modern IT is permitted to be built atop vague, implementation defined types stuck in the 1970s (Integer), why not boldly move on to the 1980s and turn the assumption "all are >= 2" into a rock solid type? type Entity_Count is range 2 .. Max_Possible_Number; function Min_Crossings(M, C, R : Entity_Count) return ... If the suffix of Entitiy_Count hides too much information ("Is this an int, actually?") in the context of an algorithmic exercise, you could call it Entity_int.