Skip to content
Advertisement

Tag: linked-list

Better way to reverse a linkedlist in javascript

I tried this: And my Node class: here head is the main LinkedList’s head, and HEAD is the head of new one. I’m using stack here. And the algorithm is in linear complexity. Instead of creating new Node everytime, I think there is some better way to implement this. Can you suggest some other ways? Also is it possible to

Advertisement