I know how to add nodes before and after the head and tail, but I dont know how to add a node to an empty doubly linked list. How would I go about doing this? Thank you.
-
2That depends on the implementation of a doubly-linked list that you're using -- Python doesn't come with one. But the sensible thing would be to add it exactly the way you would add a node to a non-empty list, except that now it doesn't matter whether you add it to the head or the tail.Katriel– Katriel2013-03-29 12:47:35 +00:00Commented Mar 29, 2013 at 12:47
Add a comment
|