Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: comparing two test files Date: Fri, 23 Dec 2011 07:50:10 -0800 Organization: A noiseless patient Spider Lines: 31 Message-ID: References: <5fdf65a2-052b-4c0b-b6bf-bc4dc8a7dd02@v24g2000prn.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 23 Dec 2011 15:50:13 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="21689"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UawxemSWYAz/5npUYa3ZRwDxTxsXwLrQ=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <5fdf65a2-052b-4c0b-b6bf-bc4dc8a7dd02@v24g2000prn.googlegroups.com> Cancel-Lock: sha1:FR7hgBXhmf1Jxy+YtnNOGjHiPLQ= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10974 On 12/23/2011 12:45 AM, ruds wrote: > it iterates through the first file but doest not enter the second > while loop after reading once onle i.e for the first line of first > file. Besides the advice above on "how to debug," I think you need some practice on making the algorithm in the first place. Try to compare two files yourself, by hand. Write down each step as you do it. Leave no detail out, no matter how small! Then, try to write your steps as a flow chart. Review what decisions you made at each step and include them on the flow chart. It's very important to get these steps in something approximating an algorithm so you can start to understand it better. Next pseudo code is out. Pay attention here to basic optimization and "clean" code, something that looks like an algorithm. Try here to get a block structure pseudo code. Then go back to the first step, where you just wrote down your steps, and try some new inputs. Files with different things in them. Make sure each of your steps still works. If not, then change to so it does. Check your flowchart for the same files. Make sure the flow chart works. Then check your pseudo code; did it also work or not? Taking the difference of two files is actually a hard problem. You should expect to make a considerable effort to get it right.