Author: Stan Eisenstat
Subject: Re: CS223 HW4
Date: Thursday, 02 Apr 2020, 08:28:34
> For HW4, I implemented quicksort in Qsort.c but xQuick.pl returns M-bM-^@M-^\not
> quicksortM-bM-^@M-^] on some of the test files. Is there something wrong with
> my code, or is this a bug with the xQuick.pl program?
No, it is a problem with your program, which has
seqeuences like
if (strncmp(...) > 0)
...
else if (strncmp(...) < 0)
...
else
...
that perform the same comparison twice in a row. This
inflates the number of compares and thus the limit
C*#compares + N on the number of calls to pushdD() and
addD(), making it easier to satisfy.
--Stan-
PREV
INDEX
NEXT