Chapter 8Programming Problems Using Heap Memory

DOI: 10.1201/9781003257981-8

8.1 Sort an Array

This problem asks you to write a program that reads integers from a file, sorts the numbers, and writes the sorted numbers to another file.

8.1.1 Generate Test Input and Expected Output

A common problem for many software developers is to create versatile test cases. If a developer types test cases by hand, only small test cases can be created. Without good test cases, it is difficult to test whether a sorting program is correct. Without a correct sorting program, it is difficult to generate large test cases. Fortunately, for sorting integers, two Linux commands can solve this problem easily: (1) The shuf command can shuffle numbers. (2) The sort ...

Get Intermediate C Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.