[algogeeks] hari wants to chat

2011-06-29 Thread hari
--- hari wants to stay in better touch using some of Google's coolest new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-6ef61f8152-0a1809a38a-VhQtjvDuk5tyOdsQd1DUn_Ec5dU You'

[algogeeks] Re: sum of two

2011-05-20 Thread hari
We can sort using STL sort function in main() before function call of arraysum(). On May 20, 6:49 am, Gunjan Sharma wrote: > First of all there is an infinite loop in this code > Secondly it works only for sorted array. > > > > > > > > > > On Fri, May 20,

[algogeeks] Re: sum of two

2011-05-20 Thread hari
In while loop have i,j which points first and last index of array. In while loop, Check the sum of a[i],a[j], If sumk) j++; return b; } On May 20, 4:38 am, amit wrote: > given an array of integers, and an integer k, find out two elements > from the array whose sum is k in O(n) time. if no such

[algogeeks] Spoj problem (dynamic programming)

2010-09-07 Thread hari
You are given: * a positive integer n, * an integer k, 1<=k<=n, * an increasing sequence of k integers 0 < s1 < s2 < ... < sk <= 2n. What is the number of proper bracket expressions of length 2n with opening brackets appearing in positions s1, s2,...,sk? plz.. explain how to solve th

[algogeeks] Re: National Instruments: linked list subtraction

2010-08-25 Thread hari
I dont think it can be done without reversing the linked list!! On Aug 25, 2:54 pm, Raj N wrote: > Input : Two large singly linked lists representing numbers with most > significant digit as head and least significant as last node. > Output: Difference between the numbers as a third linked list w

[algogeeks] 5 pirate problem

2010-08-23 Thread hari
Five pirates (of different ages) have 100 gold coins to divide amongst themselves. They decide on the following approach to determine how much each pirate receives: The eldest pirate proposes an allocation. All pirates (including the eldest) then vote on the proposal. If the majority accept the p

[algogeeks] Re: simple random number generator

2009-10-05 Thread Prabhu Hari Dhanapal
100;i++) { x1=( ( (a*x0) + c)% m) ; printf(" %d \n",x1); x0=x1; } } On 10/5/09, Prabhu Hari Dhanapal wrote: > hi , > > I think the Linear Congruential Generator is believed to be the most > simple of all PRNGs. > > The sequence can be generated using the following, >

[algogeeks] Re: simple random number generator

2009-10-05 Thread Prabhu Hari Dhanapal
ne looking at the sequence to notice any > obvious patterns. > > Thanks > > > > -- Hari --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group,

[algogeeks] Re: Graph Limited Flow !

2009-09-30 Thread Prabhu Hari Dhanapal
flow of water is constricted by the pipe of minimum diameter. Hope that helps :) On Wed, Sep 30, 2009 at 9:17 AM, sharad kumar wrote: > ya something like finding different augmenting paths caluclating the max > flow.pls refer coreman. > > On Wed, Sep 30, 2009 at 1:36 PM,

[algogeeks] Re: Form of 3^n

2009-09-23 Thread Prabhu Hari Dhanapal
is to recursively divide the number by 3 and check the > remainder. > > > > Is there any other way using bit manipulation or anything else?? > > > > > > -- > > > > Anshya Aggarwal > > > > -- > > Yesterday is History. > > Tomorrow is a Mystery.

[algogeeks] Re: algo problem

2007-04-16 Thread Hari Nathan
Isn't linear time enough? Go form the begining to the end, whenever a[i] > a[i+1] you a new subsequence. You can keep track of where each one ends and then pick the longest. On 4/15/07, Sachin <[EMAIL PROTECTED]> wrote: > > > http://en.wikipedia.org/wiki/Longest_increasing_subsequence_problem >