Member-only story
Reverse a Linked List 🅾➡🅾| Coding Interview | Linked List | Medium | Python & cpp
I am assuming that you already know what is a linked list and if you don’t, it doesn’t matter, you will get the idea with this article. This is the first problem we are going to solve under the linked list category. I think it is a simple problem, we just have to think about the steps (not so complex) to solve it.
I have prepared a DSA sheet, give it a try. You might find it helpful.
Let’s start with the things we are going to cover.
Table of contents
- Description
- Recursive Solution (with example & images)
- Code & complexities
- Iterative Solution (with example & images)
- Code & complexities
Description
Given a linked list, reverse it.
Linked list: A data structure which is made up of nodes. Each node holds some data and a pointer to the next node. The first node is referenced…