This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

k vs k-th in sort.texi


Hello,

  I was reading the chapter on sorting and was confused by the phrase
"k-th largest elements".  Probably it's just me, but I think of the
"k-th largest" as a single element, while what is referred to here is
a set of k elements, the largest ones.  In case others might share my
confusion, I've attached a patch to sort.texi in which "k-th largest"
is replaced by "k largest".

  Also, other minor wordsmiths.  For instance, "The size of the subset
k" implies to me that k is a set, when it is in fact an integer.  So I
changed this to "The size k of the subset..." in its first usage, and
then just "k" in subsequent usages (which are all: "k must be less than
or equal to...")

  Finally, I altered the example to use size_t instead of int for the
values of k, also of N (size of big array), and of index i. Myself, I
tend to use int, but I understand that size_t is preferred, and so our
examples might as well show this.

  FWIW, I wouldn't mind a k-th largest value function; ie, a single
value that could be returned instead of requiring me to allocate some
memory for a small array.  But since this would probably require me to
allocate a work array of size k anyway, it really is fine the way it
is.

regards,
jt

---------------------------------------------
James Theiler                     jt at lanl dot gov
MS-D436, NIS-2, LANL        tel: 505/665-5682
Los Alamos, NM 87545        fax: 505/665-4414
----- Space and Remote Sensing Sciences -----

Attachment: sort.texi.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]