Tag: Linked List

Reverse linked list c++

Reverse linked list data structure Given a singly linked list. Write a function that reverses the linked list. Provide explanation and logic. Reverse linked list solution An iterative solution is to use two pointers. The first pointer points to the current node and the other pointer points to the next node. You loop through the

Circular linked list in c++

Circular linked list data structure This is a typical interview question. Given a singly linked list. Write a function that detects if the linked list is circular (has a loop) which means the last node points to another node in the list Circular linked list algorithm Explanation: There are several ways to solve this problem.