Algorithms

Saturday, September 3, 2011

Atoi

›
int atoi( char* pStr ) { int iRetVal = 0; if (pStr) { while ( *pStr && *pStr = '0' ) { iRetVal ...

Check if array elements are consecutive

›
The idea is to check for following two conditions. If following two conditions are true, then return true. 1) max – min + 1 = n where max...

Majority Element

›
A majority element in an array A[] of size n is an element that appears more than n/2 times (and hence there is at most one such element)....

Searching a pivot in the sorted rotated array

›
Implement the following function, FindSortedArrayRotation, which takes as its input an array of unique integers that has been sorted in asce...
3 comments:

Searching an Element in a Rotated Sorted Array

›
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). How do you fi...
3 comments:

Find Minimum Spanning Tree in a weighted graph

›
Prim's Algorithm : Click Here Kruskal's Algorithm : Click Here

Segregate even and odd nodes in a Linked List

›
Given a Linked List of integers, write a function to modify the linked list such that all even numbers appear before all the odd numbers ...
›
Home
View web version

About Me

My photo
Viswanadh
Software Engineer
View my complete profile
Powered by Blogger.