unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Roland Orre <roland.orre@neurologic.se>
Subject: bug in sort.c
Date: Thu, 14 Oct 2004 14:07:36 +0200	[thread overview]
Message-ID: <1097755656.5281.3487.camel@localhost> (raw)

The following two lines in scm_restricted_vector_sort_x
are wrong:

  SCM_VALIDATE_INUM_RANGE (4, endpos,0, vlen+1);
  len = SCM_INUM (endpos) - spos;

they should be:

  SCM_VALIDATE_INUM_RANGE (4, endpos,0, vlen);
  len = SCM_INUM (endpos) - spos + 1;

at least to be consistent with the documentation. Apart from that
I've found that quicksort is extremely slow for vectors and am now
using a merge sort also for vectors. (It's me having put that code
ther earlier and I'll look into why it is slow, but quicksort worst
case complexity is O(N^2), in average O(N log N) but merge sort
is always O(N log N) as I understand so it may be correct, but I'll
post the suggested restricted_vector_msort_x on the guile-user.

	Best regards
	Roland Orre





_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


             reply	other threads:[~2004-10-14 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14 12:07 Roland Orre [this message]
2004-10-19 14:33 ` bug in sort.c Marius Vollmer

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1097755656.5281.3487.camel@localhost \
    --to=roland.orre@neurologic.se \
    /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: link
Be 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).