We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Head is returned as a reference or pointer to the next node.
With the help of head we'll traverse the complete list until we find the node (elif condition) which is pointing to the None or null.
The first if condition is executed only when the list is completely empty.
In this manner, recursive calls are made to insert function to reach the last node of the current list and then the passed data parameter is inserted there.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 15: Linked List
You are viewing a single comment's thread. Return to all comments →