sorting - The C programming language 2. ed. question -


I'm reading a well-known book "C programming language, version 2" and a practice that I'm stuck with . I can not understand what is to be done in reality, so I will explain it to anyone.

Exercise 5-17:

  • Add field-searching ability, so that the fields can be sorted within the fields, one of each field options Can be sorted by independent set.

What does the input program expect from the command line; What does "independent set of options" mean?

Study POSIX utility, ignoring the legacy option. Or study of the program; It has even more options than the posix sort .

You need to decide between Nickel Butterworth's fixed width areas as suggested by your answers and variable-width areas. You need to decide how the character variable separates the wide-field . For each fund (string, case-to-day string, phone-book string, integer, floating point, date, etc.) as well as sort direction (forward / reverse or ascending / descending), you should support the sorting mode.

'Independent Options' means that you can do different criteria for different areas. That is, you can arrange the field 1 to sort in the ascending string order, to sort the field 3 in ascending integer sequence, and field 9 can be sorted in ascending date sequence.

Note that when sorting, the primary criteria first is the specified area when two rows are compared, if there is a difference between the first key field in two rows, then do not consider the subsequent key areas. is done. When the two lines in the first row are the same, the criteria of the second key field determines the relative sequence; Then, if the second key field is the same, then the third key area is consulted, and so on. If no more important field is specified, then the default default sort criteria is "the complete line of input in ascending string order". In a static type of original data, the relative sequence of two rows is preserved, which are similar when comparing the key field criteria (instead of comparing the default, whole line comparison).


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -