Helping engineers with technical interviews

Tag: LinkedList Page 2 of 3

Leetcode 463 Island Perimeter

Swapping nodes in a linked list

Swapping nodes in a linked list means exchanging the positions of two nodes in the list. For example, if we have a linked list 1 -> 2 -> 3 -> 4 -> 5 and we want to swap the second and fourth nodes, the result will be 1 -> 4 -> 3 -> 2 -> […]

Read More

Implement doubly linked list using shared ptr

A shared pointer is a smart pointer that can manage the lifetime of an object by keeping track of how many pointers are pointing to it. In a doubly linked list, a shared pointer can be used to manage the memory of the nodes. In a doubly linked list, each node has two pointers: a […]

Read More

Introduction to circular linked list

Linked list is an important data structure in computer science and programming. Interviewers may ask questions about linked list to assess a candidate’s understanding of the data structure, problem-solving skills, and coding ability. Understanding linked list is important for software development roles that involve designing and implementing data structures and algorithms. It is worth spending […]

Read More
Leetcode 463 Island Perimeter

Circular linked list traversal in Python

A circular linked list is a linked list type data structure similar to a doubly linked list that consists of a set of nodes, each of which contains some data and a pointer to the next node in the list. Unlike a regular linked list, the last node in a circular linked list points back […]

Read More
Leetcode 463 Island Perimeter

Reverse a doubly linked list using recursion

Probelm statement: Reverse a doubly linked list using recursion A doubly linked list is a data structure where each node has a pointer to the previous node as well as a pointer to the next node in the list. In this problem, we are given a doubly linked list and we need to reverse it […]

Read More
Leetcode 463 Island Perimeter

Detect loop in linked list using Floyd’s algorithm

Detecting a loop in a linked list is a common problem in computer science, and one way to solve it is by using Floyd’s algorithm, also known as the “tortoise and hare” algorithm. Floyd’s algorithm uses two pointers to traverse the linked list and detect if there is a loop in it. Here’s how you […]

Read More
Leetcode 463 Island Perimeter

Remove duplicates from a linked list

Remove duplicates from a linked list in Python without extra space To remove duplicates from a linked list in Python without using extra space, you can use a two-pointer approach where one pointer iterates through the list, and the other checks for duplicates and removes them. Here’s an example implementation:… Read More

Read More
Leetcode 463 Island Perimeter

Top 10 interview questions on linked lists

Learning about linked lists is important from an interview point of view because linked lists are a fundamental data structure in computer science, and they are frequently used in interview questions and programming challenges. Linked lists are used to store a collection of data elements that are connected together in a sequence. They are used […]

Read More

Introduction to doubly linked list

A doubly linked list is a data structure that allows for bi-directional traversal. It has prev and next pointers for each node, which enables more flexibility in operations like insertion, deletion, and searching. A doubly linked list is a data structure that consists of a sequence of nodes, each of which contains two links, one […]

Read More

Introduction to Linked List

This article highlights the difference between linked lists and other data structures. Real-life usage of linked list and how it can be implemented in different programming languages. A linked list is a linear data structure consisting of a sequence of nodes, where each node contains a value and a reference (or pointer) to the next […]

Read More

Page 2 of 3

Powered by WordPress & Theme by Anders Norén