Talk:Flatten a list: Difference between revisions

→‎Vandalization-like modification to C code: Intermediate representation, task description, and relax
(→‎Vandalization-like modification to C code: Intermediate representation, task description, and relax)
Line 79:
 
It should also be pointed out that one of the hallmarks of C is its ability to reinterpret data. The high-performance Fortran and C programmers have long used arrays to model sequences or lists. The trick is to decouple the contents of the list from the structure of the list. This allows you to reinterpret the list by simply replacing the part that describes the structure of the list. Using this approach, the problem of flattening a list can be solved on the order of O(1). Essentially, this is what my original solution did (although on order of O(n)). It extracted the contents of the list, and because a flattened list has almost no structure, there really wasn't anything left to do except print the results. So please consider that the solution I originally posted is far from being vandalism and should be reinterpreted in the spirit of C. --[[User:Pserice|Paul Serice]] Fri Oct 1 22:27:51 UTC 2010
: I think it was the lack of an intermediate representation that set people off. I think there was an assumed expectation that there would be a transformation from the input format to an internal representation, and another transformation to the output format; that way, with the intermediate representation defined on input and output, the actual mechanics would be clearer to the casual observer. (I didn't write the task, I don't know what was going through the task author's head. I'm just making an educated guess based on watching activity on the site.) If I read your code correctly, you optimized out the intermediate representation.
:
: Was the code correct to the letter of the task? I don't know. My suggested approach in cases like these would be to show both examples, with an explanation of how their approaches are different.
:
: All in all, relax; this sounds to me like a case where the task description could require clarification. And I think Paddy's intuition might be right; you should stick around and get a feel for how things work. Keep participating, and look at those items I left in your talk page about recommended reading and such; I'm still looking forward to your participation. :) --[[User:Short Circuit|Michael Mol]] 00:57, 2 October 2010 (UTC)