4 ms·
Ah, I was thinking more in terms of C/C++/Java/C# style linked lists, which tend to look something like this: class List<T> { ListNode<T> head; ListN
by douche 10y ago
Ah, I was thinking more in terms of C/C++/Java/C# style linked lists, which tend to look something like this:
class List<T> {
ListNode<T> head;
ListNode<T> end;
int size;
}
class ListNode<T> {
T data;
ListNode<T> next;
// possibly, if it is doubly-linked
ListNode<T> prev;
}