BT Set – 2, BT Set – 1, Question Set (101- ..) Binary Tree Visualizer Remove nodes on root to leaf paths of length < K. GFG Algo: The idea here is to use post order traversal of the tree. Before removing a node we need to check that all the children of that node in the shorter… Continue reading Binary Tree – Set 3

## Binary Tree – Set 2

BT Set - 1, BT Set - 3 , Question Set(41-101) Binary Tree Visualizer *** Populate Inorder Successor for all nodes Code This is also referred to as Threaded Binary Tree. GFG Algo: 1. We need to do a reverse inorder traverse. 2. The same can be easily implemented using queue.We first do an inorder… Continue reading Binary Tree – Set 2

## Self Balancing Binary Tree

AVL Tree Implementation. Code. GFG - Insert, Delete Youtube Time Complexity: The rotation operations (left and right rotate) take constant time as only few pointers are being changed there. Updating the height and getting the balance factor also take constant time. So the time complexity of AVL insert remains same as BST insert which is O(h) where… Continue reading Self Balancing Binary Tree

## Binary Tree – Set 1

BT Set - 2, BT Set - 3 , Question Set (1- 40) Binary Tree Visualizer *** Binary Tree Traversal. Depth First Traversals: Code GFG Time Complexity: O(n) where n is number of nodes in the binary tree Inorder: Left, Root, Right - [Pending] Morris Traversal for Inorder ( No stack, No Recursion) (Code, GFG) - Iterative using… Continue reading Binary Tree – Set 1

## Sorting – Set 3

Sorting, Sorting Set 1, Sorting Set 2 [Merge Sort] Sort array after converting elements to their squares Given a array of both positive and negative integers ‘arr[]’ which are sorted. Task is to sort square of the numbers of the Array. GFG Algo: 1. Efficient solution is based on the fact that given array is… Continue reading Sorting – Set 3

## Prime

Sieve of Eratosthenes - Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number. GFG Least prime factor of numbers till n - Given a number n, print least prime factors of all numbers from 1 to n. GFG Algo: Use Sieve of… Continue reading Prime

## Sorting – Set 2

Sorting Set 1 Sorting Set 3 Given an array of n integers. The task is to check whether an arithmetic progression can be formed using all the given elements. If possible print “Yes”, else print “No”. GFG Algo: We don't really need to know the arithmetic difference. We can just take the diff of first two and… Continue reading Sorting – Set 2

## Sorting – Set 1

Sorting Set 2 Sorting Set 3 Given an array of n distinct elements. Check whether the given array is a k sorted array or not. A k sorted array is an array where each element is at most k distance away from its target position in the sorted array. GFG. Algo: Copy the array into another… Continue reading Sorting – Set 1

## Design: Image Hosting Application

Original Article Link Below are few key takeaway from the article above. For details refer to the original article. It makes sense to split out reads and writes of images into their own services - The advantage of this approach is that we are able to solve problems independently of one another—we don't have to… Continue reading Design: Image Hosting Application