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
Data Structures
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
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.
In order Successor in Binary Search Tree – Binary Search Tree – In order successor of a node is the next node in In order traversal of the Binary Tree.