Data Structures and Algorithms

Design and implementation of interesting data structures and algorithms. You may find it useful either in your computer science course curriculum or in technical interviews of companies like Microsoft, Amazon, Google, Yahoo, Sun, Oracle etc

Tuesday, September 18, 2018

Index

›
1.  Linked List implementation in Java 2. Other Linked List Problems      a.  Reverse a Linked List      b.  Get Nth element from the en...
Sunday, September 16, 2018

Largest Sum contiguous subarray

›
 Problem .   An array can contains negative and positive numbers. You have to find the sub-array where the sum of all numbers in the sub...
Friday, November 18, 2016

Remove consecutive same character substring repeatedly

›
Problem: This program doesn't like consecutive characters in a string. If it find consecutive characters them it bombs them and generat...
1 comment:
Thursday, April 21, 2011

Sort an array having 0,1,2 without counting

›
1.Use 3 pointers low,mid & hi. 2.low will point to first element from left which is not 0 3. hi will point to first element from right...
Thursday, April 14, 2011

To find nth element from the end in a linked list

›
Use two pointers. Start the second pointer when the first pointer reaches nth element.

Middle of a linked list in one traversal

›
Problem        Find the middle element of a linked list, with just one traversal. Solution. Use 1 slow pointer and one fast pointer....

Sieve of Eratosthenes

›
To find all the prime numbers less than or equal to a given integer n: 1. Create a list of consecutive integers from two to n: (2, 3, 4, .....
›
Home
View web version
Powered by Blogger.