The canonical data for Pascal’s Triangle includes a test for a triangle of zero rows, which it represents as an empty list. Since it is not clear how to make an empty array in C, the test implementation requires one row containing a zero. This is not intuitive: a triangle with one row is not a triangle of zero rows, and what does that zero value represent? More seriously, the code calls create_triangle(0)
but then free_triangle
with an argument of 1. I was mentoring someone whose solution depended on the number of rows in the two calls being the same, and this difference caused mysterious and frustrating memory corruption issues. I don’t see much instructional value from this test, so I propose removing it. I can create a PR if the you all agree with me.
1 Like