How to find the intersection point of two linked lists?

The problem statement is: Given the head pointers (head1 and head2 ) of two linked lists, find the intersection node of the two lists. For the above image, program needs to output: 4 as the intersection point. Naive Approach Run two for loops: outer loop from 0 to head1.length() and inner […]

C++ Standard Template Library (STL) – [Linked List]

The C++ Standard Template Library (STL) is a powerful library of C++ template classes that provide general-purpose classes and functions. It has implementations of many popular and commonly used algorithms and data structures like vectors, linked-lists, queues, priority queues, and stacks. In this post we’ll learn about: linked-lists. Linked List To […]

Linked List

A Linked List is a data structure in which the objects are arranged in a linear order. Unlike Arrays, you cannot access any element directly through its index. Time complexity of access operation in Linked lists is O(n) where n is the size of linked list. Also unlike an array, Linked […]