Re:Special Cases Are a Code Smell
by arethuza on Friday January 25, 2019 @10:39AM
(#18998843)
Well, that's easy to fix - copy your array into a linked list so you an insert elements at the head efficiently. ;-)
[ Parent
| on HN ]
Yes, the real problem with this implementation is the data structure they use. But is `next == null` a special case? ogod what do we do?!
Re:Special Cases Are a Code Smell
by banku_brougham on Saturday January 26, 2019 @07:35PM
(#19009560)
This is interesting. Is it possible to implement a linked list while eliminating the end of the list ‘edge case’, in the fashion of the parent article?
Re:Special Cases Are a Code Smell
by pure-awesome on Monday January 28, 2019 @06:55AM
(#19016774)
Create a "sentinel" node which represents null and also points to itself, perhaps?