Adding items to end of linked list

后端 未结 9 857
夕颜
夕颜 2020-12-03 16:03

I\'m studying for an exam, and this is a problem from an old test:

We have a singly linked list with a list head with the following declaration:

clas         


        
9条回答
  •  时光取名叫无心
    2020-12-03 16:50

    Here's a hint, you have a graph of nodes in the linked list, and you always keep a reference to head which is the first node in the linkedList.
    next points to the next node in the linkedlist, so when next is null you are at the end of the list.

提交回复
热议问题