Is that a homework I see young genleman?
Also, linked list syntax is language specific, so which one of those that still use raw pointers do you use? Or don't tell me, you're working with an(oh woe, oh sorrow) objectified linked list in a mostrosity such as Java?
Importantnly let me point out that there is a Programming forum in the depths bellow. It is a bit dusty and all as most of the IM's here use ready made tools and just a few rare exceptions are willing to get their hands dirty with the cogs and oil of the programming. (For quite a many it is a bad ROI after all, programming is a beautiful but terrible beast) Your question might be better suited there.
Finally, there are specialized programming forums out there, in the wild. In the places we don't talk about. Since I can't post links yet I can only tell you the legends about them so try to open ye olde google. You will find a plethora of spaces that already solved your question many times over.