Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 28 Jul 2012 23:03:10 -0500 Message-ID: <5014B5FE.2FC3@mindspring.com> Date: Sun, 29 Jul 2012 00:03:10 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.programming Subject: Re: problem 2.1.2 from "how to solve it by computer, Dromey" References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 28 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.220.167 X-Trace: sv3-6bgtBCGypN+k0G7e+x2ilHP4wnCU4kT4Tr5oOHFRyq0O+Tw3lQ3ERVu8zG6Y2wwbLmHqOvOXNzix3sj!odkdSqyG/JxV2po6TCnqtu75BaBP/Q3lQltjdG1bh7ksJaKz2/f7mgcMF9FbPDspaAXDXZYmibIg!8KFZer78QZk= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1547 Xref: csiph.com comp.programming:2017 sathyashrayan wrote: > > I am a beginner in learning algo..So please bear with me.. > > 2.1.2 Design an algorithm that makes following exchanges of 3 varioubles.. > > a-->b-->c--| > ^ | > ^----------| > > So > a_temp = a; > b_temp = b; > c_temp = c; > > a=c_temp; > c=b_temp; > b=a_temp; > > I know this process looks ugly. Can anyone suggest a good one so that I could learn. temp = c c = b b = a a = temp -- pete