Online IDE
Free Mock
Improve your coding skills with our resources
Compete in popular contests with top coders
Explore Offerings by SCALER

Welcome to Interviewbit, help us create the best experience for you!

Currently, You are a:

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your career...

Current Company *
Enter company name
Experience *

You're all set!

Begin your success journey!

Sign Up using
Full name *
Email *
Password *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy .

Welcome back!

Log In using
Email *
Password *

Linked Lists

Go to Problems

Level 1

Jump to Level 2

Level 2

Jump to Level 3

Level 3

Jump to Level 4

Level 4

Jump to Level 5

Level 5

Jump to Level 6

Level 6

Jump to Level 7

Level 7

Jump to Level 8

Level 8

Be a Code Ninja!

Doubly Linked List Implementation

Each node in a list consists of at least three parts:

    1. Data
    2. Pointer to the previous node
    3. pointer to the next node


An example of a doubly linked list node with an integer data.
// A Doubly Linked list node
struct DoublyLinkedList
  int val;
  struct DoublyLinkedList *next, *pre;
// Doubly Linked list class
class DoublyLinkedList
    // head of list
    Node head;
    // Node class
    class Node
        int val;
        Node next, pre;
        // Constructor to create a new node
        Node(int v) {
           val = v;
# Node class
class Node:
    # Function to initialize the node object
    def __init__(self, v):
        self.val = v  # Assign value = None  # Initialize next as null
# Doubly Linked List class
class DoublyLinkedList:
    # Function to initialize the Linked List
    def __init__(self): 
        self.head = None

Serious about Learning Programming ?

Learn this and a lot more with Scaler Academy's industry vetted curriculum which covers Data Structures & Algorithms in depth.

Linked Lists Problems

List sort
Problem Score Companies Time Status
Sort Binary Linked List 200 33:12
Partition List 275
Insertion Sort List 300
Sort List 350 59:46
Pointer move
Problem Score Companies Time Status
K reverse linked list 200 60:30
Even Reverse 200 44:07
Swap List Nodes in pairs 350 33:34
Rotate List 350 33:58
List trick
Problem Score Companies Time Status
Kth Node From Middle 200 29:31
Reverse Alternate K Nodes 300 51:48
Reverse Link List II 450 57:24
Reorder List 600 57:10
List math
Problem Score Companies Time Status
Add Two Numbers as Lists 250 43:07
List Cycle 600 39:15
Free Mock Assessment
Help us know you better for the best experience
Current Employer *
Enter company name
College you graduated from *
Enter university name
Phone Number *
OTP will be sent to this number for verification
Change Number
Resend OTP
By Continuing I agree to be contacted by Scaler in the future.
Already have an account? Log in