public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Belov, Eugeny" <Eugeny_Belov@stl.sarov.ru> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: libstdc++/8195: n-th algorithm (STL) doesn`t work properly Date: Fri, 11 Oct 2002 08:46:00 -0000 [thread overview] Message-ID: <20021011154601.29050.qmail@sources.redhat.com> (raw) The following reply was made to PR libstdc++/8195; it has been noted by GNATS. From: "Belov, Eugeny" <Eugeny_Belov@stl.sarov.ru> To: Wolfgang Bangerth <bangerth@ticam.utexas.edu> Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/8195: n-th algorithm (STL) doesn`t work properly Date: Fri, 11 Oct 2002 19:42:01 +0400 Hello Wolfgang I am understanding that the principle of this algorithm (in simple terms) is to divide the sequence into 2 parts like this: smaller elements , n-th element, bigger elements, and in the general case both parts can be unsorted. But the real problem in this case is that smaller elements comes after n-th ("n-th" is the integer with value 12 - the biggiest of all other elements), i.e. the sequence after using the nth_element() is "4 4 5 6 6 6 9 _12_ 8 10" and in this case I think the n-th algorithm implementation make a mistake. With best regards. Eugeny. Wolfgang Bangerth wrote: >This is not a bug, so may be closed. > >nth_element does not sort the _entire_ array, it only makes sure that the >elements before the nth-pointer are smaller, and the ones behind that are >larger than the element pointed to by nth (the second argument). It makes >no guarantees that each of these two parts of the entire range is sorted >itself. > >Regards > Wolfgang > >------------------------------------------------------------------------- >Wolfgang Bangerth email: bangerth@ticam.utexas.edu > www: http://www.ticam.utexas.edu/~bangerth >
next reply other threads:[~2002-10-11 15:46 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-10-11 8:46 Belov, Eugeny [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-10-11 16:12 paolo 2002-10-11 8:56 Wolfgang Bangerth 2002-10-11 7:46 Wolfgang Bangerth 2002-10-11 4:16 johnb
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021011154601.29050.qmail@sources.redhat.com \ --to=eugeny_belov@stl.sarov.ru \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).