From: Ben Pfaff Date: Thu, 21 Dec 2006 06:15:05 +0000 (+0000) Subject: Add comment that ll_sort is stable, X-Git-Tag: v0.6.0~623 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e9bb21173b1ee541a7a23358552b68666005f99;p=pspp-builds.git Add comment that ll_sort is stable, which is verified by the existing set of tests. --- diff --git a/src/libpspp/ll.c b/src/libpspp/ll.c index 25b4462b..525dcc5b 100644 --- a/src/libpspp/ll.c +++ b/src/libpspp/ll.c @@ -429,6 +429,8 @@ ll_prev_permutation (struct ll *r0, struct ll *r1, In use, keep in mind that R0 may move during the sort, so that afterward R0...R1 may denote a different range. (On the other hand, R1 is fixed in place.) + The sort is stable; that is, it will not change the relative + order of nodes that compare equal. Runs in O(n lg n) time in the number of nodes in the range. */ void ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)