Create a reverse LinkedList in C++ from a given LinkedList

前端 未结 10 981
温柔的废话
温柔的废话 2020-11-30 08:37

I\'m having some trouble create a linkedlist in reverse order from a given linkedlist.

I come from a java background, and just started doing some C++.

Can yo

10条回答
  •  抹茶落季
    2020-11-30 09:07

    I'm not sure, but I think you want a doubly linked list where the node has a next and previous. It will not work using an external pointer to the list. You will not have the address of the previous node.

    If not use the method above with a stack it's a good suggestion.

提交回复
热议问题