Clone a linked list with next and random pointer – Doubly linked list – You are given a Double Link List with one pointer of each node pointing.
Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.
C++ Algorithm – Delete a Linked List node at a given position – Linked List – If node to be deleted is root, simply delete it. To delete a middle node
Design a stack with operations on middle element – Stack – The idea is to use Doubly Linked List (DLL). We can delete middle element in O(1) time
K’th smallest element in BST using O(1) Extra Space – Binary Search Tree – Given a Binary Search Tree (BST) and positive integer k, find the k’th smallest.
Find the first circular tour that visits all petrol pumps
Suppose there is a circle. There are n petrol pumps on that circle.
C Algorithm – Merge two sorted linked lists – Linked List – Write a SortedMerge() function that takes two lists, each of which is sorted in increasing order
C++ Algorithm – Merge two sorted linked lists – Linked List – Write a Sorted Merge() function that takes two lists, each of which is sorted in increasing
Implement Stack using Queues – Stack – The problem is opposite of this post. We are given a Queue data structure that supports standard operations
Reverse a Doubly Linked List- Doubly Linked List- a simple method for reversing a Doubly Linked List. All we need to do is swap prev and next pointers.
Design and Implement Special Stack Data Structure – Stack – Design a Data Structure SpecialStack that supports all the stack operations