#
Array Archive

Kadane algorithm is a famous algorithm to solve maximum subarray problem. Maximum subArray problem: From Wikipedia : In computer science, the maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional …

In this post, we will see about quick sort in java. Quick sort or partition-exchange sort, is a sorting algorithm, which is using divide and conquer algorithm. In quick sort, we first choose a pivot …

In this post, we will see how to sort an array in java. There are various ways to sort array in java. You can implement different sorting algorithms to sort an array. You can use …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to find transpose of matrix in java. Transpose of …

Given array of integers, find Maximum difference between two elements such that larger element appears after the smaller number For example: Algorithm: Lets say we have array arr of stock prices. We will track two variable :minElementTillNow and maxDifference. …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. Given an array of integers representing stock price on single day, find max profit that can …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. Problem: You are given arrival and departure time of trains reaching to a particular station. You …

In this tutorial, we will see how to rotate an array be K positions. Problem: N=6 and k=2 If Arr = {1, 2, 3, 4, 5, 6} and k=2 then rotated array will be {5, …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. If you want to practice data structure and algorithm programs, you can go through data structure and …

Problem: From Wikipedia : In computer science, the Largest sum contiguous subarray is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. For example, for the …