Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

Median in a stream of integers (running integers)

Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no duplicates. For example, let...

A program to check if a binary tree is BST or not

A binary search tree (BST) is a node based binary tree data structure which has the following properties. &#x2022; The left subtree of a node contains only nodes with...

Level order traversal in spiral form

Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7. Recommended: Please solve it on &#x201C;PRAC...

Root to leaf path sum equal to a given number

Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given number. Return fa...

Check if a given Binary Tree is SumTree

Write a function that returns true if the given Binary Tree is SumTree else false. A SumTree is a Binary Tree where the value of a node is equal to sum of the nodes p...

Partition problem DP-18

Partition problem is to determine whether a given set can be partitioned into two subsets such that the sum of elements in both subsets is same. Examples: arr[] = {1...

Subset Sum Problem DP-25

Given a set of non-negative integers, and a value sum, determine if there is a subset of the given set with sum equal to given sum. Example: Input: set[] = {3, 34, ...

Dijkstra’s shortest path algorithm Greedy Algo-7

Given a graph and a source vertex in the graph, find shortest paths from source to all vertices in the given graph. Dijkstra&#x2019;s algorithm is very similar to Pr...

Subset Sum Backtracking-4

Subset sum problem is to find subset of elements that are selected from a given set&#xA0;whose sum adds up to a given number K. We are considering the set contains no...

Search an element in a sorted and rotated array

An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you befo...