Arrays

TIPS: Algorithms on arrays can be dealt with pointers. Taking pointers one at the beginning of the array and one at the end of the array (using length of the array) will be helpful in solving array algorithms.

algorithm to remove element from an array: 1. standard way when existing order is important: traverse through the elements, once element_to_be_deleted is found, shift remaining…

algorithm to merge two sorted arrays without additional array Algorithm to merge two sorted arrays: Here we use merge sort logic…

find all pairs in an array, that sum up to particular number with best complexity: Here we discuss two possible algorithms…

finding three elements in an array whose sum is equal to a given number Here, for every element(arr[i]) that we pick, trisum-arr[i] gives us the …

find intersection of elements in two arrayscase 1: Two arrays are unsorted; Case 2: Two arrays are sorted; case 3: Two arrays are unsorted;

find group of connected 1s in a matrix Consider a two-dimensional grid of cells, each of which may be empty or filled. The filled cells that are connected form a sector…

Dynamic Programming

subsequence of array with maximum sum (Kadane’s Algorithm): This is given by Jay Kadane. Problem Statement: In a given array, find out subarray such that the sum of its elements is maximum…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Mawazo

Mostly technology with occasional sprinkling of other random thoughts

amintabar

Amir Amintabar's personal page

101 Books

Reading my way through Time Magazine's 100 Greatest Novels since 1923 (plus Ulysses)

Seek, Plunnge and more...

My words, my world...

ARRM Foundation

Do not wait for leaders; do it alone, person to person - Mother Teresa

Executive Management

An unexamined life is not worth living – Socrates

javaproffesionals

A topnotch WordPress.com site

thehandwritinganalyst

Just another WordPress.com site

coding algorithms

"An approximate answer to the right problem is worth a good deal more than an exact answer to an approximate problem." -- John Tukey