Skip to main content

41 docs tagged with "Algorithm Design Manual"

View All Tags

Balanced Parentheses

Check if a string contains properly nested and balanced parentheses, and false if otherwise.

Color Sort

Assume that we are given n pairs of items as input, where the first item is a

Find Transition Index

Given unbounded 0s followed by unbounded number of 1s, find the first index of transition.

Identical Binary Tree

Given two binary tree, find if they are identical i.e. same value at the same position & same structure

K Sorted List Merge

Give an O(n log k)-time algorithm that merges k sorted lists with a total of n

K Sum

Given a set S of n integers and an integer T,

Magic Index Search

[4-33] Algorithm to determine whether there exists an i index such as ai = i given array of {a1, a2, a3 ... an}

O1Data Structure

Construct a DS with search, remove and add operations of O(1) in worst case

Reverse Sentence

Reverse the words in a sentence—i.e., “My name is Chris” becomes “Chris is name My.”

Selection Sort

Identify the smallest element from unsorted portion and put it at the end of the sorted portion

Two Pair Sum

O(nlogn) algorithm for finding whether there exists a pair of elements, one from S1 and one

Union Find

Union-Find represent each subset as backward trees