Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Todd Carnes Newsgroups: comp.lang.c++ Subject: Re: what is a loop invariant Date: Wed, 27 Jul 2011 12:29:56 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 23 Message-ID: References: <7082e075-e6b2-4ae0-9a89-f31ae1684769@f39g2000prb.googlegroups.com> NNTP-Posting-Host: uqlV+6kNo2Z0TnMsKGN6tA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Pan/0.133 (House of Butterflies) X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:8286 On Tue, 26 Jul 2011 10:02:50 -0400, Victor Bazarov wrote: > On 7/26/2011 9:26 AM, johan1990 wrote: >> i am reading introduction to algorithms and i have no idea of what the >> concept "loop invariant" means. i really appreciate it if there is a >> easy way to explain it. :~) > > Uh... http://en.wikipedia.org/wiki/Loop_invariant isn't easy? Try it. > Also, consider 'comp.programming' for general questions like that. > > V Actually, the Wikipedia article is NOT written very well. For example, the very first sentence reads... "In computer science, a loop invariant is an invariant used to prove properties of loops." When one is defining something for someone, one should NEVER use the same word they are explaining in the explanation. (in this case "invariant"). Also, the rest of the explanation expects the reader to be fairly well versed in computer science & logic, which one cannot assume from the OP's question. Todd