duminică, 26 februarie 2017

Reverse a Linked List Recursively

http://bit.do/deHZC IMDevin Secret discount page.
Problem: Reverse a Linked List Recursively. Solution: Start with node curr as head. 1. If curr is null, return. 2. If curr's next element is null, this means it is the last node, so make this as head because the last node will be the head of reversed list. Return. 3. Recursively traverse the list. 4. Set curr.next.next to curr. 5. Set curr.next to null Code Link: http://www.ideserve.co.in/learn/reverse-a-linked-list-recursive Website: http://www.ideserve.co.in Facebook: https://www.facebook.com/IDeserve.co.in

Niciun comentariu:

Trimiteți un comentariu