Good knowledge of standard algorithms is equally important as choosing the right data structure. The following is a list of the top 25 algorithms every programmer and computer science student should know.
Techie Delight is a leading platform for technical interview preparation. We offer a huge collection of data structure problems to improve algorithmic skills and helps crack interviews of top tech companies.
This privacy policy has been compiled to better serve those who are concerned with how their Personally Identifiable Information (PII) is being used online.
Given an integer array, trim it such that its maximum element becomes less than twice the minimum, return the minimum number of removals required for the conversion.
2-Sum Problem . Longest Common Subsequence Problem . Maximum Subarray Problem . Coin Change Problem . 0-1 Knapsack Problem . Subset Sum Problem . Longest Palindromic Subsequence Problem.
Given an integer array, partition it into two subarrays having the same sum of elements.. For example, for input array {6, -4, -3, 2, 3}, the two subarrays are {6, -4} and {-3, 2, 3} having equal sum of 2.
Given an unsorted integer array containing many duplicate elements, rearrange it such that the same element appears together and the relative order of the first occurrence of each element remains unchanged.
Given an unsorted integer array whose elements lie in the range 0 to `n-1` where `n` is the array size, calculate the frequency of all array elements in linear time and using constant space.
In this post, we will see how to right-rotate an array by specified positions. For example, right rotating array `{ 1, 2, 3, 4, 5, 6, 7 }` three times will result in array `{ 5, 6, 7, 1, 2, 3, 4 }`.
Given a binary array, find the index of 0 to be replaced with 1 to get a maximum length sequence of continuous ones using the sliding window technique.
3-partition problem: Given an array of positive integers which can be partitioned into three disjoint subsets having same sum and that covers S, print the partitions... The idea is to maintain an array A[] to keep track of subsets elements. In code below, if value of A[i] is k, then it means that i'th item of S is part
Given a set of activities, along with the starting and finishing time of each activity, find the maximum number of activities performed by a single person assuming that a person can only work on a single activity at a time.
Euclid’s algorithm (or Euclidean algorithm) is a method for efficiently finding the greatest common divisor (GCD) of two numbers. The GCD of two integers, `X` and `Y`, is the largest number that divides both `X` and `Y` without leaving a remainder.