From 442a49ad5a48d417345959b903ae6a6d32d55759 Mon Sep 17 00:00:00 2001 From: Haidong Ji Date: Fri, 15 Apr 2022 15:51:30 -0500 Subject: Great C programming fun Excellent fundamentals and displine training, many tools and techniques exercises: gdb, emacs, valgrind, git --- 15_tests_subseq/next-README | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 15_tests_subseq/next-README (limited to '15_tests_subseq/next-README') diff --git a/15_tests_subseq/next-README b/15_tests_subseq/next-README new file mode 100644 index 0000000..73a18f8 --- /dev/null +++ b/15_tests_subseq/next-README @@ -0,0 +1,31 @@ + + 1. Create a file called maxSeq.c and write the function: + size_t maxSeq(int * array, size_t n); + + which returns the length of the maximum increasing contiguous + subsequence in the array. The parameter n specifies the length + of the array For example, if the array passed in were + + { 1, 2, 1, 3, 5, 7, 2, 4, 6, 9} + + this function would return 4 because the longest sequence + of (strictly) increasing numbers in that array is 1, 3, 5, 7 + which has length 4. Note that 1,3,5,7,9 is an increasing + subsequence, but is not contiguous (finding discontiguous + ones efficiently takes techniques we haven't learned yet). + + Note that the subseqence does not need to increase at a + constant rate (or follow any other pattern besides being strictly + increasing). 2, 4, 67, 93, 94, 102 would be a valid increasing + sequence of length 6. + + +2. Compile and test your code using the test-subseq.c you wrote + previously. (as before, compile the .c files separately, and link + them together). + +3. Submit your code for maxSeq.c + + +Hint: + Can you abstract a complex step out into a simple function? \ No newline at end of file -- cgit v1.2.3