Print path from root to a given node in a binary tree

Print path from root to a given node in a binary tree
Print path from root to a given node in a binary tree. Given a Binary tree and a Key, Print a path from root to a key node. Note: Given tree is Binary Tree and not Binary Search Tree. Lets see sample input and output for better understanding: Print...

Simple Deadlock Program in Java

Simple Deadlock Program in Java
Simple java program to create Deadlock. Deadlock describes a situation where two or more threads are blocked forever, waiting for each other. Let's consider an example, in the office we have shared Printer and Scanner where Employees...

Difference between process and thread

Difference between process and thread
Difference between process and thread. Point 1: A process is an executing instance of an application. Thread is independent path of execution within a process. Process can have multiple threads, Point 2: Threads itself is capable enough to do...

Delete Middle Node of Linked List in Java

Delete Middle Node of Linked List in Java
Delete Middle Node of Linked List in Java. Given a linked list, Delete the middle node of linked list. Lets see sample input and output for better understanding: ...

Remove duplicates from an unsorted linked list in Java.

Remove duplicates from an unsorted linked list in Java.
Remove duplicates from an unsorted linked list in Java.. Given an unsorted linked list, Remove duplicates from it. Lets see sample input and output for better understanding: ...

Check linked list is palindrome or not in java

Check linked list is palindrome or not in java
Check linked list is palindrome or not in Java. A palindromic number is a number that is the same when written forwards or backwards. Lets see sample input and output for better understanding: ...

Find Running Median from a Stream of Integers

Find Running Median from a Stream of Integers
Find Running Median from a Stream of Integers in Java. Given that integers are read from a data stream. Find median from the elements read so far in efficient way. Lets see sample input and output for better understanding: ...

Find Moving Average of Last N numbers in a Stream.

Find Moving Average of Last N numbers in a Stream.
Find Moving Average of Last N numbers in a Stream. You are given a stream of numbers, calculate moving average of last N numbers in a stream. In other words, Given a stream of integers and a window size, calculate the moving average of all integers...

Search element In Sorted Rotated Array in Java

Search element In Sorted Rotated Array in Java
Search the element In Sorted Rotated Array in Java. Given an array which is sorted in ascending order and is rotated, say for example Example: original array [1,2,3,4,5,6,7] might become [3,4,5,6,7,1,2] You are given a key to search. If key is found...

Find first non repeated character in a string in Java.

Find first non repeated character in a string in Java.
Find first non repeated character in a string in Java. Given a string, find the first non-repeating character in it. Lets see sample input and output: ...

Find largest number in Binary Search Tree which is less than or equal to N

Find largest number in Binary Search Tree which is less than or equal to N
Largest number in Binary Search Tree which is less than or equal to N. We have a binary search tree and a number N. Our goal is to find the greatest number in the binary search tree that is less than or equal to N. Print -1 if the the value of the...
Page 1 of 2812345...28Next »