top of page
Search
Abhinaw Tripathi
Jun 2, 20162 min read
Binary Tree to Binary Search Tree Conversion
Following is a 3 step solution for converting Binary tree to Binary Search Tree. 1) Create a temp array arr[] that stores inorder...
5 views0 comments
Abhinaw Tripathi
Jun 2, 20161 min read
Find k-th smallest element in BST (Order Statistics in BST)
Solution Approach: By using In order traversal of BST retrieves elements of tree in the sorted order. The in order traversal uses stack...
5 views0 comments
Abhinaw Tripathi
Jun 2, 20161 min read
Total number of possible Binary Search Trees with n keys?
Solution Approach: Before going deeper,we should know about Catlan Number. Here it is: Total number of possible Binary Search Trees...
2 views0 comments
Abhinaw Tripathi
Jun 2, 20161 min read
How to check if a Binary Tree is BST or not?
What is Binary Search Tree(BST)? A binary search tree (BST) is a node based binary tree data structure. Must have these Properties: ...
4 views0 comments
Abhinaw Tripathi
Jun 2, 20161 min read
To check if a binary tree is balanced.For this,a balanced tree is defined to be a tree such that the
Solution Approach: Point to be noted here is two sub tree differ in height by no more than one.So we can simply recurs through the...
3 views0 comments
Abhinaw Tripathi
Jun 2, 20161 min read
How to check a Linked-List is a Palindrome.
Solution Approach: First thing is we should know about palindrome. What is Palindrome? The list must be the same backwards and...
2 views0 comments
Abhinaw Tripathi
Jun 2, 20161 min read
Given a circular linked list,implement an algorithm which returns the node at the beginning of the l
Solution Approach: Create two pointers ,Fast Pointer and Slow Pointer. Move Fast Pointer at a rate of 2 and slow pointer at rate of 1....
2 views0 comments
Abhinaw Tripathi
Jun 1, 20161 min read
Flyweight Design Pattern
Flyweight reduces the cost of creating and manipulating a large number of similar objects.Flyweight is used when there is a need to...
5 views0 comments
Abhinaw Tripathi
May 26, 20161 min read
Write code to partition a linked list around a value x, such that all nodes less than x come before
Approach: We iterate through the linked list ,inserting elements into our before list or our after list.Once we reach the end of the...
28 views0 comments
Abhinaw Tripathi
May 26, 20161 min read
Delete a node in the middle of a singly linked list,given only access to that node.
Very simple problem but there is only issue with the solution is if the node to be deleted is the last node in the linked list. public...
1 view0 comments
Abhinaw Tripathi
May 26, 20161 min read
Write an algorithm to find the k'th to last element of a singly linked list.
We can approach this problem in two ways one using recursive way and other using non recursive way.if you will use recursive way then its...
3 views0 comments
Abhinaw Tripathi
May 26, 20161 min read
Linked List Programming Question and its Best Solution by Abhinaw
Question: Write code to remove duplicates from an unsorted linked list.if temporary buffer is not allowed. Solution: In order to solve...
5 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Amazon Interview Question: Assume you have a method isSubstring which checks if one word is a substr
Let say you have two string s1 and s2 ,write code to check if s2 is a rotation of s1 using only one call to isSubstring(eg. "WaterBottle"...
104 views0 comments
Abhinaw Tripathi
May 25, 20161 min read
Very Common Problem on Matrix,if an element in an MXN matrix is 0,its entire row and column are set
Solution: public void setZero(int[][] matrix) { boolean[] row= new boolean[matrix.length]; boolean[] row= new...
4 views0 comments
Abhinav Tripathi
May 24, 20162 min read
Lets talk about Software Design-Patterns
What are Design Patterns? Design Pattern is a used and tested solution for a know problem.In simple words you can say a general reusable...
1 view0 comments
Abhinaw
May 18, 20162 min read
Lets Discuss on Binary Search Tree
Binary Search Tree (Search and Insertion) Binary Search Tree, is a node-based binary tree data structure. Must have these properties for...
1 view0 comments
Abhinaw
May 18, 20162 min read
Android 6.0 Marshmallow
All Features: 1)A battery that works smarter, not harder which is Battery.Battery is an important thing in all smart-phone So we should...
5 views0 comments
bottom of page