cosmos icon indicating copy to clipboard operation
cosmos copied to clipboard

Print Nth node of a singly linked list in the reverse manner

Open rstalekar opened this issue 9 years ago • 37 comments

You must be able to fetch the nth node in a singly linked list in the reverse manner eg:- if there is a list of 100 nodes and node number 10th is passed, you must be able to return the 10th node from the end of the list.

rstalekar avatar Oct 06 '17 05:10 rstalekar

I am implementing this in C.

rstalekar avatar Oct 06 '17 05:10 rstalekar

I'd like to implement it in C++.

foobar98 avatar Oct 06 '17 05:10 foobar98

Sure. Go for it 👍

AdiChat avatar Oct 06 '17 05:10 AdiChat

Aditya, were you able to review my reverse link list code

rstalekar avatar Oct 06 '17 05:10 rstalekar

Which one? Did you make a pull request?

AdiChat avatar Oct 06 '17 05:10 AdiChat

Yes of course

rstalekar avatar Oct 06 '17 05:10 rstalekar

Yes. I see. I have merged it 🎉

AdiChat avatar Oct 06 '17 05:10 AdiChat

Oh is it, why didn't I get a mail then?

rstalekar avatar Oct 06 '17 06:10 rstalekar

You should have overlooked. Take a look at the pull request 👍 #518

AdiChat avatar Oct 06 '17 06:10 AdiChat

In which directory should I add my file?

foobar98 avatar Oct 06 '17 06:10 foobar98

Create a folder n_th_node_linked_list under here and place your code there 👍

AdiChat avatar Oct 06 '17 06:10 AdiChat

Made a PR. Kindly review it. #671 Thanks.

foobar98 avatar Oct 06 '17 06:10 foobar98

Merged 👍

AdiChat avatar Oct 06 '17 06:10 AdiChat

How about a version of this algorithm (PrintNthToLast) as a templated algorithm in c++?

MarsMSJ avatar Oct 06 '17 07:10 MarsMSJ

Aditya, how can I update the git repository , since when I had cloned earlier there was no directory for the nth node directory

rstalekar avatar Oct 06 '17 08:10 rstalekar

I used git pull, but it shows Already up-to-date, but don't see the directory which you created inside Linked_lists. Can I add and commit this in Linked_lists itself.

rstalekar avatar Oct 06 '17 08:10 rstalekar

I would like to do this in c++

anku580 avatar Oct 06 '17 08:10 anku580

I cloned and did a git add of my soruce code in the n_th_node_linked_list and did a commit, however when i try doing a git push it gives the following error;- remote: Permission to OpenGenus/cosmos.git denied to rstalekar. fatal: unable to access 'https://github.com/OpenGenus/cosmos.git/': The requested URL returned error: 403

rstalekar avatar Oct 06 '17 09:10 rstalekar

@rstalekar You need to clone this repository and push in your local work-space 👍

AdiChat avatar Oct 06 '17 13:10 AdiChat

What am I doing wrong here as per you? I did a git clone 'https://github.com/OpenGenus/cosmos.git/ in my home directory Then I navigated to the Linked_lists/ n_th_node_linked_list and then wrote my code and did git add . git commit also went through , only when I do git push I get the above error.

rstalekar avatar Oct 06 '17 15:10 rstalekar