Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

# Minimum time required to produce m items

Consider n machines which produce same type of items but at different rate i.e., machine 1 takes a1 sec to produce an item, machine 2 takes a2 sec to produce an item....

# Suffix Tree Application 4 – Build Linear Time Suffix Array

Given a string, build it&#x2019;s Suffix Array We have already discussed following two ways of building suffix array: Naive O(n2Logn) algorithm Enhanced O(nLogn) alg...

# Sqrt (or Square Root) Decomposition Set 2 (LCA of Tree in O(sqrt(height)) time)

Prerequisite : Introduction and DFS The task is to find LCA of two given nodes in a tree (not necessarily a Binary Tree). In previous posts, we have seen how to calcu...

# Print left rotation of array in O(n) time and O(1) space

Given an array of size n and multiple values around which we need to left rotate the array. How to quickly print multiple left rotations? Examples : Input : arr[] = {...

# Rearrange positive and negative numbers in O(n) time and O(1) extra space

An array contains both positive and negative numbers in random order. Rearrange the array elements so that positive and negative numbers are placed alternatively. Num...

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

We recommend to read 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 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...

# Constant time range add operation on an array

Given an array of size N which is initialized with all zeros. We are given many range add queries, which should be applied to this array. We need to print final updat...

# XOR of numbers that appeared even number of times in given Range

Given an array of numbers of size N and Q queries. Each query or a range can be represented by L (LeftIndex) and R(RightIndex). Find the XOR-sum of the numbers that a...

# Find median of BST in O(n) time and O(1) space

Given a Binary Search Tree, find median of it. If no. of nodes are even: then median = ((n/2th node + (n+1)/2th node) /2 If no. of nodes are odd : then median = (n+1...