Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

# Write a Program to Find the Maximum Depth or Height of a Tree

Given a binary tree, find height of it. Height of empty tree is 0 and height of below tree is 3. Example Tree Recommended: Please solve it on &#x201C;PRACTICE&#x20...

# 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...

# Write a program to reverse an array or string

Given an array (or string), the task is to reverse the array/string. Examples : Input : arr[] = {1, 2, 3} Output : arr[] = {3, 2, 1} Input : arr[] = {4, 5, 1, 2} ...

# 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. Example: Input : n =10 Output : 2 3 5 7 Input : n = 20 ...

# K’th Smallest/Largest Element in Unsorted Array Set 2 (Expected Linear Time)

We recommend reading following post as a prerequisite of this post. K&#x2019;th Smallest/Largest Element in Unsorted Array | Set 1 Given an array and a number k where...

# K’th Smallest/Largest Element in Unsorted Array Set 1

Given an array and a number k where k is smaller than size of array, we need to find the k&#x2019;th smallest element in the given array. It is given that ll array ...

# K’th Smallest/Largest Element in Unsorted Array Set 3 (Worst Case Linear Time)

We recommend reading following posts as a prerequisite of this post. K&#x2019;th Smallest/Largest Element in Unsorted Array | Set 1 K&#x2019;th Smallest/Largest Eleme...

# Longest Common Prefix using Trie

Given a set of strings, find the longest common prefix. Input : {&#x201C;geeksforgeeks&#x201D;, &#x201C;geeks&#x201D;, &#x201C;geek&#x201D;, &#x201C;geezer&#x201D;} ...

# Write a program to reverse an array or string

Given an array (or string), the task is to reverse the array/string. Examples : Input : arr[] = {1, 2, 3} Output : arr[] = {3, 2, 1} Input : arr[] = {4, 5, 1, 2} ...

# K’th Smallest/Largest Element in Unsorted Array Set 3 (Worst Case Linear Time)

We recommend reading following posts as a prerequisite of this post. K&#x2019;th Smallest/Largest Element in Unsorted Array | Set 1 K&#x2019;th Smallest/Largest Eleme...