Middle of the Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list, return the middle node of a given linked list. Example  Input :- head = Output :- 10 Input :- head = Output :- 15 Solution Create two variables fast and slow, then move both Read More

Remove Nodes from Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a singly linked list and an integer value, remove all nodes from a given linked list, whose value is equal to a given integer value. Example  Input :- head = , node = 4 Output :- Input :- head = Read More

Delete a Node in Linked List | Linked List Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a node of the singly linked list, write a program to delete the given node. Note :- Given node will not be a tail of singly linked list. Example  Input :- head = , node = 4 Output :- Input :- Read More

Average of Levels in Binary Tree | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, return the average of all the nodes values on each level in the form of a list. Example  Average value of nodes on level 0 is 3, on level 1 is 14.5, on level 2 is 7.5 and on level 3 is 4.6. So result is Read More

Level Order Traversal of Binary Tree | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, return the level order traversal of its node values. In level order traversal, we traverse a binary tree from left to right and level by level. Example  Level order traversal of above binary tree is     Algorithm  In Read More

Minimum Distance Between BST Nodes in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary search tree, find out the minimum difference between the values of any two nodes in the tree. Example  Difference between node 16 & 17, 17 & 18 is minimum in above binary search tree. So result is 1.   Algorithm  InOrder traversal of binary search tree returns the list Read More

PreOrder Traversal of Tree in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, return the preorder traversal of its node values. Example  Preorder traversal of above binary tree is   Algorithm  Preorder traversal is also known as prefix traversal. In preorder traversal, we recursively process all the nodes of a tree. Read More

InOrder Traversal of Tree in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, return the inorder traversal of its node values. Example  In order traversal of above binary tree is   Algorithm  Inorder traversal is also known as infix traversal. In inorder traversal, we recursively process all the nodes of a Read More

PostOrder Traversal of Tree in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, return the postorder traversal of its node values. Example  Post order traversal of above binary tree is   Algorithm  Postorder traversal is also known as postfix traversal. In postorder traversal, we recursively process all the nodes of a Read More