Algorithms questions

Fonte incerta, forse quora.

I have prepared a good set of programming questions that might help you in ramping up.
Heap – Max Heaps and Min Heaps
Conversions : Decimal ,Binary, Hex, Octal (All other possible combinations)
90 Degrees Matrix conversion
Quick Sort + Applications
Merge Sort + Applications
Remove duplicates in a String — In place
Reverse a string – Inplace
Decide if 2 strings are anagrams or not ?
Binary Search
Reverse SLL without using any extra nodes
Maximum Sub array [Kadane Algorithm]
Find an element which is repeated more than n/2 times in a given set/array. [Moores Voting algorithm]
Find and element in rotated Binary sorted array
Implement power function without pow() function
Verify if given linked list is circular/cyclic or Acyclic. Follow up can be to indicate the starting point of cycle
Implement Blocking queue
Find a pair in array that will sum up to particular number
Reverse a double linked list
Reverse pairs in SLL. i.e I/P : a->b->c->d->e->f O/p : b->a->d->c->f->e
Segregate even and odd nodes in a given linked list
Addition of 2 linked lists to separate one. (also learn inplace)
Convert SLL in to DLL (XOR based linked lists)
Circular shift an array of integer input array by ‘k’ number of elements
Search for a given pattern in text [Rabin Karp Algorithm]
atio() and itoa() implementations (ASCII to integer and Integer to ASCII)
Binary Semaphores
Generate subsets of given set of integers
Generate all permutations of a given string
Level order Traversal
Inorder successor of a given node in BST (Binary Search Tree)
Find ‘k’ largest /smallest elements in a given array (Hint : can use heaps)
Heap Sort + applications
Find minimum length unsorted sub array on which storing them makes complete sorted array
Search if a given pattern exists in input text using Suffix Arrays
Re-arrange a string so that all same characters are ‘d’ distant apart
Knights tour problem
Rat in Maze [Back tracking]
Find out if two rectangles overlap or not
Find closest pair of points in the given plane
Find all subset of elements in the given set whose sum equals to a given target
Compute x^y such that it can work for floats and negative values
Find median of given two input sorted arrays
Find total no of zeros in a given array of 1’s followed by 0’s
Find if there is any sub array which sums up to zero
Count number of inversions in a given array
Find minimum element in a rotated sorted array
Find the fixed point in the given array
Find the maximum sub array sum [D&C]
Count # of occurrences of a number in the sorted array
Find the max and min element in a given array with minimal number of comparisons
Check if a number is multiple of 3 or not ?
One line function to check if a number is power of 2 or not ?
Function to multiple a number by 7.
Function to multiple two numbers without using * product operator
Function to write Fibonacci series in iterative manner
Generate all prime numbers less than or equal to n [Sieve of Erastho..]
Given a number, Find the next biggest palindrome number
Implement logic for fair coin from biased coin
Check if a number is divisible by 7 without mod operator
Find all the possible words from a phone keypad
Lexicographic sort of permutation of all words
Shuffle a given array / deck of cards [Fisher Yates Algo]
Reservoir Sampling Algorithm
Select ‘k’ random elements from ‘n’ elements
Given a number ‘n’. generate a pascal triangle out of it.
Write an exponential precision function [Taylor series]
Generate all prime factors of a given number
Generate all possible combination of ‘r’ elements in a given array of size ‘n’ [Probability Distribution Function]
Length of Longest common sub sequence of given sequence of numbers
Find minimum cost path in a given cost matrix
Total # of solutions in a coin change problem
Find binomial co-efficient
Knap-sack standard problem
Egg-Drop standard problem
Length of longest palindrome sequence
Palindrome Partitioning
Maximum Length of chained increasing pair
Find the middle of given linked list
Check if a given Single linked list is a palindrome or not
Insert/Delete/Search in max heap
Implement sizeof() operator
Find successor of given BST
Find all triangle triples in given array
Find lowest common ancestor of a given node
Return a single element by knocking out all other elements by ‘k’ [Josephus]
Given a sorted skewed binary tree, Create a BST out of it.
Given an array with integers, Output all the elements which were repeated exactly twice
Maximum depth/height/diameter of a given tree
Serialize and De serialize a given binary tree
Find single repeated or non-repeated number in conditional list. (XOR)
Implement “diff” in linux
Program to count # of set bits in a given integer.
Convert BST to doubly linked list
Convert integer to String without .toString()
GCD of two numerals
Given an array in post order traversal, check whether the given array is in BST or not
Reverse the words in a given English sentence
Get the median of a stream of large numbers
Print all the paths of a given Binary Tree from root to leaf
Modify array such that arr[i] == arr[arr[i]] Inplace
Find the missing number in a billion number list
Bit wise addition

Leave a Reply