[algogeeks] Sorting a very large number of intergers

2013-06-13 Thread MAC
How would one sort 1 billion integers.  .. I gave external sorting answer
but he waned more .. What should i say ?

Asked me to tell him how would the problem change  if total of  4 threads
are given. How would you solve ?



thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] Infinite stream , identify distinct k kintegers

2013-06-01 Thread MAC
Given an infinite stream of integers with only k distinct integers, find
those distinct integers. How would you modify your solution if k is also
very large and cannot use hash table.





thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] amazon f2f round question ..

2013-05-24 Thread MAC
kindly explain  visualizing a balanced BST as a graph   and unable to
underdstand your point


thanks
--mac


On Fri, May 24, 2013 at 6:04 AM, Avi Dullu  wrote:

>
> On Sat, May 11, 2013 at 10:29 AM, Aman Jain  wrote:
>
>> 2. from this no*de u*, again apply* dfs* to find longest distant node
>> from this node.Let us say that node is v.
>>
>
> Small doubt about the solution. Consider this graph a -> b -> c -> d
>
> You randomly choose vertex 'b' and do a DFS. Your "u" will be vertex 'd'.
> Then you do DFS from d, but its out degree is 0.
> So your DFS ends at 'd' itself and you report the solution as b->c->d. But
> the solution is a->b->c->d. What did I miss?
>
> My proposal:
> Topological Sort <http://en.wikipedia.org/wiki/Topological_sorting> the
> graph and keep removing the nodes from vertices which have out degree of 0
> (given the DAG, there will always be atleast one such vertex). Rest is self
> explanatory :)
>
>
> Veni Vedi Slumber !
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] Re: stack. Mid element in o(1)

2013-05-22 Thread MAC
i meant the middle elemnt

so if 1 ,2,3 <--top then 2 is mid value /..


accessing a middle element via the index is not right as it would mean you
are not using it as a stack , but as an array ..

thanks
--mac


On Wed, May 22, 2013 at 9:34 PM, Don  wrote:

> Do you mean the middle position or median value?
>
> If you implement the stack in an array, finding the middle position
> should be easy.
>
> Don
>
> On May 22, 11:45 am, MAC  wrote:
> > Saw this on  a seperate group .. Since answer not known to me sharing it
> > here
> >
> > you have a stack . Exposed functionality is push and pop only .
> >
> > What minimal modifications would you do such that
> > you should find middle element in o(1) time .
> >
> > I think this is only possible if you make sure that at push you store the
> > middle element with the top element as well .. this would mean push would
> > cease to be o(1)   & become o(n) .. . or is there some other trick ?
> >
> > thanks
> > --mac
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] stack. Mid element in o(1)

2013-05-22 Thread MAC
Saw this on  a seperate group .. Since answer not known to me sharing it
here

you have a stack . Exposed functionality is push and pop only .

What minimal modifications would you do such that
you should find middle element in o(1) time .

I think this is only possible if you make sure that at push you store the
middle element with the top element as well .. this would mean push would
cease to be o(1)   & become o(n) .. . or is there some other trick ?


thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] amazon f2f round question ..

2013-05-11 Thread MAC
Given an acyclic graph. Give an algorithm to find the pair of nodes which
has the maximum distance between them, i.e. the maximum number of edges in
between them


any suggestion ?


thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] Re: Array of intergers with repeating elements

2013-05-08 Thread MAC
sry link was not pasted
http://stackoverflow.com/questions/7338070/finding-an-element-in-an-array-where-every-element-is-repeated-odd-number-of-tim

thanks
--mac


On Thu, May 9, 2013 at 12:40 AM, MAC  wrote:

> if one can explin me this i think this problem will get solved
>
>
> thanks
> --mac
>
>
> On Wed, May 8, 2013 at 12:02 AM, MAC  wrote:
>
>>
>> I was asked this in recent amazon onsite interview and asked o write code
>>
>> Given an Array of integers . N elements occur k times and one element
>> occurs b times, in other words there are n+1 distinct Elements. Given
>> that 0 < b < k find the element occurring b times.
>>
>> We know k is NOT even .
>>
>>
>> thanks
>> --mac
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] Re: Array of intergers with repeating elements

2013-05-08 Thread MAC
if one can explin me this i think this problem will get solved


thanks
--mac


On Wed, May 8, 2013 at 12:02 AM, MAC  wrote:

>
> I was asked this in recent amazon onsite interview and asked o write code
>
> Given an Array of integers . N elements occur k times and one element
> occurs b times, in other words there are n+1 distinct Elements. Given
> that 0 < b < k find the element occurring b times.
>
> We know k is NOT even .
>
>
> thanks
> --mac
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] Array of intergers with repeating elements

2013-05-07 Thread MAC
I was asked this in recent amazon onsite interview and asked o write code

Given an Array of integers . N elements occur k times and one element
occurs b times, in other words there are n+1 distinct Elements. Given that 0
< b < k find the element occurring b times.

We know k is NOT even .


thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] Interesting link on connecting town problem

2011-09-17 Thread MAC
Hi guys ,

Got an interesting link to share :
http://www.youtube.com/watch?v=dAyDi1aa40E&feature=share

It talks about *Maths Problem: Connect the towns solution (Motorway Problem)
. * the solution finding by soap bubble is unique :)



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] need info

2011-09-04 Thread MAC
HI guys , need to know what is a company commvault ,. Is that a good comp
and is it a good pay master
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Find Max Sum Value Pairs

2011-09-01 Thread MAC
since its sorted , cant we just take last (largest if assedning) elements of
each and  return o(1) .. (since +ve we can do so i guess)



On Thu, Sep 1, 2011 at 2:15 PM, Navneet Gupta  wrote:

> Given two sorted positive integer arrays A(n) and B(n), we define a
> set S = {(a,b) | a in A and b in B}. Obviously there are n2 elements
> in S. The value of such a pair is defined as Val(a,b) = a + b. Now we
> want to get the n pairs from S with largest values. need an O(n)
> algorithm.
>
>
> --
> Regards,
> Navneet
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] graph

2011-08-31 Thread MAC
@mohit : i disagree.. precisely bcoz of the reason you cited we can only
check common nodes between cycles and nothing else .. please correct me if i
am wrong

On Wed, Aug 31, 2011 at 9:34 PM, mohit verma  wrote:

> @ MAC , i think it was not right to inspect common nodes in different
> cycles.
>
> say  in the above picture the two inner nodes of inner cycle are out side
> the bigger cycle (towards A) then co-ordinates of the inner  cycle will
> change and no cycle nested but having common nodes.
>
>
> On Wed, Aug 31, 2011 at 9:13 PM, MAC  wrote:
>
>> it was loops sharing common edges ,, (i said find all cycles and see if
>> there is some cycles having coomon nodes between them  and he was not happy
>> )
>>
>>
>>
>> On Wed, Aug 31, 2011 at 8:54 PM, Piyush Grover > > wrote:
>>
>>> loop within a loop, what exactly that means??
>>> Nee to consider the planarity or two loops sharing common edge/s??
>>>
>>>
>>> On Wed, Aug 31, 2011 at 8:46 PM, MAC  wrote:
>>>
>>>> Q  The question asked in interview of a startup : suppose you have a
>>>> graph as shown bellow : please see the attachment . The red dots are graph
>>>> vertexes ( you can see 1 vertex alone , aloof )
>>>>  so you can see there are 2 cycles one inside another . How will you
>>>> find such a scenario in a graph i.e. a cycle within a cycle.
>>>>
>>>> When i couldn't answer he asked how will you find strongly conected
>>>> components of a graph (since it was follow up it MIGHT be related to
>>>> solution but thought its good to share )
>>>>
>>>>
>>>> any thoughts on these 2 questions
>>>> --
>>>> thanks
>>>> --mac
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> thanks
>> --mac
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> 
> *MOHIT VERMA*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] graph

2011-08-31 Thread MAC
it was loops sharing common edges ,, (i said find all cycles and see if
there is some cycles having coomon nodes between them  and he was not happy
)



On Wed, Aug 31, 2011 at 8:54 PM, Piyush Grover wrote:

> loop within a loop, what exactly that means??
> Nee to consider the planarity or two loops sharing common edge/s??
>
>
> On Wed, Aug 31, 2011 at 8:46 PM, MAC  wrote:
>
>> Q  The question asked in interview of a startup : suppose you have a graph
>> as shown bellow : please see the attachment . The red dots are graph
>> vertexes ( you can see 1 vertex alone , aloof )
>>  so you can see there are 2 cycles one inside another . How will you find
>> such a scenario in a graph i.e. a cycle within a cycle.
>>
>> When i couldn't answer he asked how will you find strongly conected
>> components of a graph (since it was follow up it MIGHT be related to
>> solution but thought its good to share )
>>
>>
>> any thoughts on these 2 questions
>> --
>> thanks
>> --mac
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] graph

2011-08-31 Thread MAC
Q  The question asked in interview of a startup : suppose you have a graph
as shown bellow : please see the attachment . The red dots are graph
vertexes ( you can see 1 vertex alone , aloof )
 so you can see there are 2 cycles one inside another . How will you find
such a scenario in a graph i.e. a cycle within a cycle.

When i couldn't answer he asked how will you find strongly conected
components of a graph (since it was follow up it MIGHT be related to
solution but thought its good to share )


any thoughts on these 2 questions
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

<>

Re: [algogeeks] Re: large nos

2011-08-24 Thread MAC
@don : can you please share some link for NTL ???
@dave i am unable to understand what you mean ... this is because since
these are very large numbers i can never save them as integers in ints or
longs , so how ??


On Wed, Aug 24, 2011 at 11:57 PM, Debabrata Das <
debabrata.barunhal...@gmail.com> wrote:

> well if you store value in link list as a polynomial  the you can do
> multiplication as cross product.
> eg. 345=3*100 + 4*10 + 5*1
>
> On Wed, Aug 24, 2011 at 11:53 PM, Don  wrote:
> > Use NTL.
> > Don
> >
> > On Aug 24, 12:43 pm, MAC  wrote:
> >> any thoughts ? if we have link lists to represent very large integer
> numbers
> >> how to implement multiply and devide operator
> >> --
> >> thanks
> >> --mac
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] large nos

2011-08-24 Thread MAC
any thoughts ? if we have link lists to represent very large integer numbers
how to implement multiply and devide operator
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Longest palindrome

2011-08-21 Thread MAC
suffix tree will solve it .

On Sun, Aug 21, 2011 at 11:46 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> how abt goimg with brute force?? check  starting from first character if
> first 2 chars frm a palin, then chck if first 3 form a palin... continue
> until the end of string.
>
> Now starting from 2nd char, do the same.
>
> keep a var max to store the max value.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] COMMVAULT

2011-08-21 Thread MAC
do u have any info on its pay scale etc ? if possible please share the same
.

On Sun, Aug 21, 2011 at 10:54 PM, MAC  wrote:

> do u have any info on its pay scale etc ? if possibel plea
>
>
> On Sun, Aug 21, 2011 at 9:15 PM, cdr  wrote:
>
>> Plz tell me abt the written test and interview process in
>> commvault...thanks in advance friends...
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/7HbT58YH950J.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> thanks
> --mac
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] COMMVAULT

2011-08-21 Thread MAC
do u have any info on its pay scale etc ? if possibel plea

On Sun, Aug 21, 2011 at 9:15 PM, cdr  wrote:

> Plz tell me abt the written test and interview process in
> commvault...thanks in advance friends...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/7HbT58YH950J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: any good link?

2011-08-21 Thread MAC
thanks .. any os specific ??

--mac

On Sun, Aug 21, 2011 at 7:57 PM, Navneet  wrote:

> geeksforgeeks.org
> careercup.com
>
> On Aug 21, 7:13 pm, MAC  wrote:
> > can anyone suggest good link to review Algos and OS concepts
> >
> > --
> > thanks
> > --mac
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] any good link?

2011-08-21 Thread MAC
can anyone suggest good link to review Algos and OS concepts

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Challenge

2011-08-20 Thread MAC
@Sanjay  awesome aproach frd ..

--mac
On Sat, Aug 20, 2011 at 3:39 PM, Sanjay Rajpal  wrote:

> My previous argument was wrong.
>
> In the worst case, within a row, you may have to traverse the whole row,
> and rest other rows for just testing. Therefore O(m+n).
>
> But if we dont traverse the other rows once we traversed the whole row, it
> can be O(n) in the best case.
>
>
> Sanju
> :)
>
>
>
> On Sat, Aug 20, 2011 at 3:04 AM, Sanjay Rajpal  wrote:
>
>>  Got it in the worst case also it will be O(m+n)
>> Worst case will be
>> 0001
>> 0011
>> 0111
>> 
>> 0001
>> 0011
>> 0111
>> 
>>
>> at each step just make one comparison and one step towards left, which in
>> worst case is
>> m comparisons and n increments, so final solution is O(m+n).
>>
>> Correct me if I am wrong.
>> Sanju
>> :)
>>
>>
>>
>> On Sat, Aug 20, 2011 at 3:00 AM, Shashank Gupta 
>> wrote:
>>
>>> In worst case it would be O(m*n)..
>>>
>>>
>>>
>>> On Sat, Aug 20, 2011 at 3:27 PM, shady  wrote:
>>>
>>>> @Sanjay awesome solution
>>>> it won't be O(n^2) in worst case, it will be O(m+n) only
>>>>
>>>> On Sat, Aug 20, 2011 at 3:22 PM, Sanjay Rajpal wrote:
>>>>
>>>>>  Yes, thats right.
>>>>> I think we can do the following also :
>>>>>
>>>>> Lets us assume rows are sorted in increasing order.
>>>>>
>>>>> start from first row say i. Traverse the array from the end of the row
>>>>> towards the beginning till 0 occurs say at position j.
>>>>> now proceed to the next row i+1, check the value at i+1,j  if it is 0,
>>>>> go to next row i+2,j
>>>>> else if its 1, then go to left till 0 occurs and store that index of 0
>>>>> and follow to the next row.
>>>>>
>>>>> In the worst case, it will be O(n^2), but in general its a good
>>>>> approach i guess. what do u say guys ?
>>>>>
>>>>> Average Case O(m+n) ?
>>>>>
>>>>>
>>>>> Sanju
>>>>> :)
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Aug 20, 2011 at 2:47 AM, shady  wrote:
>>>>>
>>>>>> binary search on every row which will give solution in O(m*(logn))
>>>>>>
>>>>>>  On Sat, Aug 20, 2011 at 3:13 PM, Sanjay Rajpal wrote:
>>>>>>
>>>>>>>  Sorry I forgot to mention that.
>>>>>>>
>>>>>>> Sanju
>>>>>>> :)
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Algorithm Geeks" group.
>>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>
>>>>>>
>>>>>>   --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Algorithm Geeks" group.
>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>   --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> 

Re: [algogeeks] Re: print all paths which sum up to a value.

2011-08-19 Thread MAC
  10
20 30
4   66 7

now how do u make 60 => 20 +10+30
how do u make 36 :: 10 + 20 +6  30+6




On Fri, Aug 19, 2011 at 8:37 PM, Arun Vishwanathan
wrote:

> @mac: just to clear my understanding, u need to print paths that sum up to
> a Value which means the value of the nodes in a path is added right to see
> if it satisfies this Value? does the value at each node have any relevance
> as such? I mean can it be any value at any node or does value at a node
> satisfy something like a bst property?
>
>
> On Fri, Aug 19, 2011 at 2:04 PM, anshu mishra 
> wrote:
>
>> start  from leaves.(leaves have possible sum only its value)
>> go up step by step
>> save all the possible sums on that node.
>>
>> for example
>> if left node has possible sums( 4, 6, 7 ,13) and right node has
>> possible sums (3, 5, 9); and node itself value has 5 than
>> this node all possible sums will be (8, 10, 11, 12, 14, 18)
>>
>> till u reach the root node u have all possible sums at each node.
>>
>> search ur desired sum node in the tree track all possible path for that
>> sum(u have to just only downside of the tree).
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>  "People often say that motivation doesn't last. Well, neither does
> bathing - that's why we recommend it daily."
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: print all paths which sum up to a value.

2011-08-19 Thread MAC
any suggestion frds ?? my thinking is eitther
a) root + left formsa path
b) oot +right form a path
c) left +root +right form a path

d) path only in left
e) path only in right

this thought process seems to be worng to me as its highly expensive and i
am myself not convinced of what to do next . Any suggestion ???

--mac

On Fri, Aug 19, 2011 at 1:20 PM, MAC  wrote:

>
> can someone explain how to solve this:
>
> You are given a binary tree in which each node contains a value. Design an
> algorithm to print all paths which sum up to that value. Note that it can be
> any path in the tree - it does not have to start at the root.
>
> (please write how to solve it i.e. logic u came up and algo &¬ just
> another program)
>
> --
> thanks
> --mac
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] print all paths which sum up to a value.

2011-08-19 Thread MAC
can someone explain how to solve this:

You are given a binary tree in which each node contains a value. Design an
algorithm to print all paths which sum up to that value. Note that it can be
any path in the tree - it does not have to start at the root.

(please write how to solve it i.e. logic u came up and algo &¬ just
another program)

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] longest repeated substring

2011-08-18 Thread MAC
A string can have many sub-strings inside it . find the longest substring
which is repeated maximum number of times. in case of 2 options repeated
same number of times , largest one needs to be ouput and in case same length
and same number of times repeated , anyone can be outputted.

abcdefcbcdfbcdefef  has bcd and ef repeated multiple times but bcd count

trie apraoch is fine , but in interview difficult to code ,.so definately
some other solution is requested . please also give non-efficient , but easy
to code solution if any
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: |a-b| + |b-c| + |c-a|

2011-08-18 Thread MAC
in the example below , answer shd be 0 , . by your  apraoch this is not
commig


10,25,35

10,25,30

5 ,6,25,30



On Thu, Aug 18, 2011 at 1:08 PM, Anantha Krishnan <
ananthakrishnan@gmail.com> wrote:

> If we move the maximum then difference will get larger but our aim is to
> minimize the difference.
>
> Thanks & Regards,
> Anantha Krishnan
>
>
> On Thu, Aug 18, 2011 at 1:01 PM, MAC  wrote:
>
>> as per my understanding , you are increasing the minimum value so that it
>> reaches closer to the maximum others that we are not moving right now . Why
>> are you not moving the maximum instead  ?
>>
>> basically i need the reason why you are doing so ..
>>
>> thanks
>> --mac;
>>
>>
>> On Thu, Aug 18, 2011 at 12:08 PM, Anantha Krishnan <
>> ananthakrishnan@gmail.com> wrote:
>>
>>> Let,
>>>
>>> min_dif=INT_MAX
>>>
>>> 1.Sort the N arrays A,B,C.
>>> 2.Find the minimum and maximum of A[0],B[0],C[0].
>>> 3.Take the difference between MAX-MIN values.
>>> 5.If the difference is less than min_dif then update min_dif and save all
>>> n values.
>>> 6.Now increment the index of the array which contains minimum element.
>>> 7.repeat these steps till end of array is reached for atleast one array.
>>>
>>> Please let me know if you find some difficulties with my explanation.
>>>
>>> Thanks & Regards,
>>>
>>> Anantha Krishnan
>>>
>>> On Thu, Aug 18, 2011 at 10:42 AM, MAC  wrote:
>>>
>>>> any suggestion on how to approach this problem ??
>>>>
>>>>
>>>>
>>>> On Wed, Aug 17, 2011 at 10:37 PM, MAC  wrote:
>>>>
>>>>> Given n arrays, find n number such that sum of their differences is
>>>>> minimum. For e.g. if there are three arrays
>>>>>
>>>>> A = {4, 10, 15, 20}
>>>>> B = {1, 13, 29}
>>>>> C = {5, 14, 28}
>>>>>
>>>>> find three numbers a, b, c such that |a-b| + |b-c| + |c-a| is minimum
>>>>>
>>>>>
>>>>> where a E A , bEB , cEC
>>>>>
>>>>> . Here the answer is a = 15, b = 13, and c = 14
>>>>>
>>>>>
>>>>> if we had 4 arrays we would have wanted
>>>>> |a-b| + |b-c| + |c-d| +|d-a| where a E A , bEB , cEC and dED  to  be
>>>>> minimum ...
>>>>>
>>>>> --
>>>>> thanks
>>>>> --mac
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> thanks
>>>> --mac
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> thanks
>> --mac
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: |a-b| + |b-c| + |c-a|

2011-08-18 Thread MAC
as per my understanding , you are increasing the minimum value so that it
reaches closer to the maximum others that we are not moving right now . Why
are you not moving the maximum instead  ?

basically i need the reason why you are doing so ..

thanks
--mac;

On Thu, Aug 18, 2011 at 12:08 PM, Anantha Krishnan <
ananthakrishnan@gmail.com> wrote:

> Let,
>
> min_dif=INT_MAX
>
> 1.Sort the N arrays A,B,C.
> 2.Find the minimum and maximum of A[0],B[0],C[0].
> 3.Take the difference between MAX-MIN values.
> 5.If the difference is less than min_dif then update min_dif and save all n
> values.
> 6.Now increment the index of the array which contains minimum element.
> 7.repeat these steps till end of array is reached for atleast one array.
>
> Please let me know if you find some difficulties with my explanation.
>
> Thanks & Regards,
>
> Anantha Krishnan
>
> On Thu, Aug 18, 2011 at 10:42 AM, MAC  wrote:
>
>> any suggestion on how to approach this problem ??
>>
>>
>>
>> On Wed, Aug 17, 2011 at 10:37 PM, MAC  wrote:
>>
>>> Given n arrays, find n number such that sum of their differences is
>>> minimum. For e.g. if there are three arrays
>>>
>>> A = {4, 10, 15, 20}
>>> B = {1, 13, 29}
>>> C = {5, 14, 28}
>>>
>>> find three numbers a, b, c such that |a-b| + |b-c| + |c-a| is minimum
>>>
>>>
>>> where a E A , bEB , cEC
>>>
>>> . Here the answer is a = 15, b = 13, and c = 14
>>>
>>>
>>> if we had 4 arrays we would have wanted
>>> |a-b| + |b-c| + |c-d| +|d-a| where a E A , bEB , cEC and dED  to  be
>>> minimum ...
>>>
>>> --
>>> thanks
>>> --mac
>>>
>>>
>>
>>
>> --
>> thanks
>> --mac
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: |a-b| + |b-c| + |c-a|

2011-08-17 Thread MAC
any suggestion on how to approach this problem ??



On Wed, Aug 17, 2011 at 10:37 PM, MAC  wrote:

> Given n arrays, find n number such that sum of their differences is
> minimum. For e.g. if there are three arrays
>
> A = {4, 10, 15, 20}
> B = {1, 13, 29}
> C = {5, 14, 28}
>
> find three numbers a, b, c such that |a-b| + |b-c| + |c-a| is minimum
>
>
> where a E A , bEB , cEC
>
> . Here the answer is a = 15, b = 13, and c = 14
>
>
> if we had 4 arrays we would have wanted
> |a-b| + |b-c| + |c-d| +|d-a| where a E A , bEB , cEC and dED  to  be
> minimum ...
>
> --
> thanks
> --mac
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: EMC software ???

2011-08-17 Thread MAC
http://www.careercup.com/page?pid=emc-interview-questions

this might help u :) best of luck

On Wed, Aug 17, 2011 at 10:42 PM, htross  wrote:

> please reply soon anyone...times running out.
>
> On Aug 17, 7:54 pm, htross  wrote:
> > hi everyone...what kind of questions will be asked in EMC first
> > round???please help..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] |a-b| + |b-c| + |c-a|

2011-08-17 Thread MAC
Given n arrays, find n number such that sum of their differences is minimum.
For e.g. if there are three arrays

A = {4, 10, 15, 20}
B = {1, 13, 29}
C = {5, 14, 28}

find three numbers a, b, c such that |a-b| + |b-c| + |c-a| is minimum


where a E A , bEB , cEC

. Here the answer is a = 15, b = 13, and c = 14


if we had 4 arrays we would have wanted
|a-b| + |b-c| + |c-d| +|d-a| where a E A , bEB , cEC and dED  to  be minimum
...

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] array question

2011-08-16 Thread MAC
The question needed o(1) space and o(n)  time ...  o(n) map approach is
obviously fine but space is taken up ...

On Tue, Aug 16, 2011 at 2:38 PM, Raghavan  wrote:

> @sukran:
> If you were asking for the map based solution
>
> space and time complexity would be o(n).
>
>
> On Tue, Aug 16, 2011 at 2:34 PM, sukran dhawan wrote:
>
>> what is the complexity in which it has been done ?
>>
>> On Tue, Aug 16, 2011 at 1:41 PM, MAC  wrote:
>>
>>>
>>> Given an array of integers. Each number in the array repeats ODD number
>>> of times, but only 1 number repeated for EVEN number of times. Find that
>>> number.
>>>
>>>
>>> --
>>> thanks
>>> --mac
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks and Regards,
> Raghavan KL
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] array question

2011-08-16 Thread MAC
Given an array of integers. Each number in the array repeats ODD number of
times, but only 1 number repeated for EVEN number of times. Find that
number.


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] sumitabha das unix ebook ?

2011-08-16 Thread MAC
thanks Deoki for this also :)

On Tue, Aug 16, 2011 at 10:29 AM, Deoki Nandan  wrote:

> but this is not whole book only some portion
>
>
> On Tue, Aug 16, 2011 at 10:28 AM, Deoki Nandan  wrote:
>
>> here is the link for sumitbha das ebook
>>
>> http://www.mediafire.com/?ej74twjczauidil
>>
>> On Tue, Aug 16, 2011 at 9:57 AM, MAC  wrote:
>>
>>> does anyone has sumitabha das unix ebook for unix ?
>>>
>>> --
>>> thanks
>>> --mac
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> **With Regards
>> Deoki Nandan Vishwakarma
>>
>> *
>> *
>>
>>
>
>
> --
> **With Regards
> Deoki Nandan Vishwakarma
>
> *
> *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] sumitabha das unix ebook ?

2011-08-15 Thread MAC
does anyone has sumitabha das unix ebook for unix ?

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] de shaw ? any link for questions ?

2011-08-14 Thread MAC
can someone please suggest sample ques for de shaw ?? some lnk would help

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Design .. how to attack ???

2011-08-12 Thread MAC
if someone  can share one good solution , it would really help me. I am
unable to form the answer to these questions

--mac

On Fri, Aug 12, 2011 at 1:15 PM, MAC  wrote:

> thanks guys .. so lets take the question we had  "design a car rental
> system"   .. so the interviewer can say , ok requirement is that you have a
> pool of cars , people come and book a car for a particular time slot if
> available . This is the most basic thing . so now what , what shd i do next
>
> --mac
>
>
> On Fri, Aug 12, 2011 at 1:11 PM, keyan karthi 
> wrote:
>
>> First thing tat should come to your mind s ' requirements ' ask him
>> wat de requirements are. He will expect tat..
>>
>> On 8/12/11, MAC  wrote:
>> > Hi guys ,
>> >
>> > Can anyone help me in understanding what is expected when some some one
>> >  asks you " design a car rental system" . Exactly what all is required
>> to be
>> > told to the interviewer .
>> >
>> > --
>> > thanks
>> > --mac
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algogeeks@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > algogeeks+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>> >
>>
>> --
>> Sent from my mobile device
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> thanks
> --mac
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Design .. how to attack ???

2011-08-12 Thread MAC
thanks guys .. so lets take the question we had  "design a car rental
system"   .. so the interviewer can say , ok requirement is that you have a
pool of cars , people come and book a car for a particular time slot if
available . This is the most basic thing . so now what , what shd i do next

--mac

On Fri, Aug 12, 2011 at 1:11 PM, keyan karthi wrote:

> First thing tat should come to your mind s ' requirements ' ask him
> wat de requirements are. He will expect tat..
>
> On 8/12/11, MAC  wrote:
> > Hi guys ,
> >
> > Can anyone help me in understanding what is expected when some some one
> >  asks you " design a car rental system" . Exactly what all is required to
> be
> > told to the interviewer .
> >
> > --
> > thanks
> > --mac
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Design .. how to attack ???

2011-08-11 Thread MAC
Hi guys ,

Can anyone help me in understanding what is expected when some some one
 asks you " design a car rental system" . Exactly what all is required to be
told to the interviewer .

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] student and company match algo

2011-08-03 Thread MAC
thanks ashish .

Can you please share links where this is explained clearly . i am unable to
understand the the solutions which i find on google.
llike PROPOSE REJECT ALGORITHM:

suppoose we had the priorities as

stud1:amz->gog->adbe
std2:adbe->goog->amz
std3:goog->adb->amz

and any priorities by companies then by algo explained as PROPOSE REJECT
ALGORITHM will assign std1 as amz , std2 as adb and std 3 as goog even
though it might not be correct .

i think i have misundesrtood this concept somehow .
Sharing some link will be helpful to me .


thanks
--mac

On Wed, Aug 3, 2011 at 2:28 PM, Ashish Modi  wrote:

> Its a problem derived from Stable Marriage Problem, Google it u'll find
> sol.
>
> On Wed, Aug 3, 2011 at 1:54 PM, MAC  wrote:
> > Suppose you have N companies visiting your college and your college has N
> > students . You as placement coordinator knows that each student will get
> > placed and your college policy is that each student can take ONLY 1 job
> and
> > each company can take ONLY 1 student . Each student has told
> > the placement coordinator his priority . So student A says i will first
> want
> > to join ggl, if not  i will like to join amz if not adb and so on for
> > N companies . So each of these N students tell you ,
> > the placement coordinator his preference . Next each company who enters
> > campus takes a separate exam and ranks the students and says its
> preference
> > .So when adb visits campus , adb will say I want student A , if not i
> want
> > student F if not i want student G and so on for all N students . So all
> > these N companies takes separate exam and tells the coordinator its
> > preference order . So you have N preference lists from companies and
> > N preference lists from students.
> >
> > As a placement coordinator , with all student preferences and with all
> > company preferences find the best matrix ie which student joins
> > which company .
> > --
> > thanks
> > --mac
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
>
>
> --
> Regards
> Ashish
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] student and company match algo

2011-08-03 Thread MAC
Suppose you have N companies visiting your college and your college has N
students . You as placement coordinator knows that each student will get
placed and your college policy is that each student can take ONLY 1 job and
each company can take ONLY 1 student . Each student has told
the placement coordinator his priority . So student A says i will first want
to join ggl, if not  i will like to join amz if not adb and so on for
N companies . So each of these N students tell you ,
the placement coordinator his preference . Next each company who enters
campus takes a separate exam and ranks the students and says its preference
.So when adb visits campus , adb will say I want student A , if not i want
student F if not i want student G and so on for all N students . So all
these N companies takes separate exam and tells the coordinator its
preference order . So you have N preference lists from companies and
N preference lists from students.

As a placement coordinator , with all student preferences and with all
company preferences find the best matrix ie which student joins
which company .
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Google Interview Question

2011-01-05 Thread MAC
dangling pointers ?? maybe..  also corrupted heap


On Wed, Jan 5, 2011 at 4:46 PM, bittu  wrote:

> You are given a the source to a application which is crashing when
> run. After running it 10 times in a debugger, you find it never
> crashes in the same place. The application is single threaded, and
> uses only the C standard library. What programming errors could be
> causing this crash? How would you test each one?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] tarjan

2011-01-04 Thread MAC
can someone please share a non-wiki link for tarjan algorithm for strongly
connected component   . a video lecture link would be really nice ..
in case you have understanding of how it works , please share your thoughts
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Interview question amazon

2010-12-31 Thread MAC
No , we had to find all the paths . Some paths could include the root .

On Tue, Dec 28, 2010 at 11:12 PM, yq Zhang  wrote:

> I think the original question says "Path can go from left subtree tree ,
> include root and go to right tree as well". This should mean the path must
> include the root.
>
>
> On Tue, Dec 28, 2010 at 4:52 AM, shanushaan 
> wrote:
>
>> Not clear what path you are referring to.
>>
>> Question. Should the path include root value always? (What is problem
>> with only left or only right path (not containing root))
>>   In your example for 16 one more path can be 0 1 5 10 as
>> well. Should algo return all the paths or just first one.
>>
>> On Dec 26, 10:08 pm, MAC  wrote:
>> > you are given a bst where each node has a int value , parent pointer ,
>> and
>> > left and right pointers , write a function to find a path with a given
>> sum
>> > value. Path can go from left subtree tree , include root and go to right
>> > tree as well . we need to find these paths also .
>> >
>> > 5
>> >1 10
>> > 0 2  6 11
>> >
>> > so to find 16 we say it is 1 to 5 to 10
>> >
>> > --
>> > thanks
>> > --mac
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Interview question amazon

2010-12-26 Thread MAC
you are given a bst where each node has a int value , parent pointer , and
left and right pointers , write a function to find a path with a given sum
value. Path can go from left subtree tree , include root and go to right
tree as well . we need to find these paths also .


5
   1 10
0 2  6 11

so to find 16 we say it is 1 to 5 to 10

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Find a specific number in a special matrix.

2010-12-24 Thread MAC
move from top rightmost column , go down if the number being searched is
greater or left if the number being seracehd is small .. O(m+n)

if u wanted to search 5 , u start from 3 (top right) , and since 5>3 , u go
down to 4 , then 5 >4 so go down , u reach 6 . now 5 <6 so u will need to go
left .. till u find 5 or less than 5

hope this helps

regards
--mac

On Sat, Dec 25, 2010 at 8:25 AM, yq Zhang  wrote:

> Suppose you have a matrix n*m. each column and row of the matrix is
> already sorted. For example:
>
> 1,2,3
> 2,3,4
> 4,5,6
>
> All 3 rows and 3 columns of above matrix are sorted. How to find a
> specific number in the matrix?
> The trivial O(nlogm) solution is to use binary search for all rows. I
> am looking for better solution.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Interview question

2010-12-24 Thread MAC
Given a Binary Matrix of 0's and 1's.
Write an algorithm to:
1) Print the largest Rectangular Sub-matrix with all 1's.
2)Print the largest Sub-matrix with all boundary elements 0.
Explain your whole algorithm with an example.

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: amazon interview question

2010-12-24 Thread MAC
updated :)

Given a boolean matrix with all the true elements on left side in the row so
> that each row can be broken into two parts left part containing only true
> elements and right part containing only false elements. Find the row with
> max number of true elements in it.
>
>
> 00011
> 0
> 1
>
> true is 0 false is 1 .. so we will say 2nd row has maximum 1  and 3rd row
> has mximum 0
>
> --
> thanks
> --mac
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] amazon interview question

2010-12-24 Thread MAC
Given a boolean matrix with all the true elements on left side in the row so
that each row can be broken into two parts left part containing only true
elements and right part containing only false elements. Find the row with
max number of true elements in it.


00011
0
1

true is 0 false is 1 .. so we will say 2nd row has maximum 1

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] matrix row column

2010-12-22 Thread MAC
you have a matrix containing integers (no range provided). The matrix is
randomly populated with integers. We need to devise an algorithm where by we
find a row number which matches exactly with a column within the matrix. We
need to return the row number and the column number for the match. The order
of of the matching elements is the same. For example, If, i'th row matches
with j'th column, and i'th row contains the elements - [1,4,5,6,3]. Then jth
column would also contain the elements - [1,4,5,6,3]. Given an n x n matrix
.


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] valid paranthesis

2010-12-07 Thread MAC
how will u generate all valid paranthesis combinations ?
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] k nearest points

2010-12-04 Thread MAC
Given set of n points (Xi, Yi), write a function to find k nearest points
from origin.
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] multisorted aarray

2010-11-24 Thread MAC
You are given a array with rows sorted and column sorted. You have to print
entire array in sorted order .. any idea??

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Debugging questions

2010-11-13 Thread MAC
in first one when fun(200) is called it goes to else part and  calls
fun(fun(199)) => fun(199) is reurns 199 and so we have fun(199) which
returns 199 as the answer

second case fun(200) is called it goes to else part and  calls fun(fun(199))
=>fun(199( is called which returns200 and so we have fun(200) .. This is now
 recursive non changing call which will eat up stack space and hence cause
segenttaion fault

--mac

On Sat, Nov 13, 2010 at 10:23 PM, sudhir mishra
wrote:

> *1st programe give output:199 but 2nd give Segmentation fault why* onle
> change in return
>
> *1)*  int fun(int i)
> {
>   if ( i%2 ) *return (i++);*
>   else return fun(fun( i - 1 ));
> }
> int main()
> {
>   printf(" %d ", fun(200));
>   getchar();
>   return 0;
> }
>
> *2) *int fun(int i)
> {
>   if ( i%2 ) *return (++i);*
>   else return fun(fun( i - 1 ));
> }
>
> int main()
> {
>   printf(" %d ", fun(200));
>   getchar();
>   return 0;
> }
>
>
>
> --
> --
> regards
> *Sudhir Mishra*
> MNNIT ALLAHABAD
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] half sorted array

2010-11-13 Thread MAC
you have an array of size n where first n/2 is sorted and the sencond half
is sorted . You need to sort the entire array inplace

Its second modification version is where first part is sorted and other is
NOT sorted . You need to make entire sorted .
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] zero sum subarray

2010-11-06 Thread MAC
an array contain +ve and -ve element, find subarray whose sum is 0

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Max to min heap

2010-10-20 Thread MAC
Convert a max heap to min heap
-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Combinations with numbers

2010-10-06 Thread MAC
Given a sum s, and an integer n as an input, find all possible combinations
that sum up to s. For example:
If s = 5, and n = 2, then output should be
0+5, 1+4, 2+3, 3+2, 4+1, 5+0
If s = 5, and n = 3, then output should be
0+0+5, 0+1+4, 0+2+3, 0+3+2, 0+4+1, 0+5+0, 1+0+4, 1+1+3, 1+2+2...2+0+3,
2+1+2...5+0+0
and so on for n = 4, 5...

-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: binary matrix

2010-10-04 Thread mac adobe
@chi .. can you please share what is this and how it resolves the issue at
hand ?

regards
--mac

On Mon, Oct 4, 2010 at 5:50 PM, Chi  wrote:

> Traverse the matrix in z-order, or hilbert-order. This is a heuristic-
> algo.
>
> On Oct 4, 1:51 pm, mac adobe  wrote:
> > Given a binary matrix, find out the maximum size square sub-matrix with
> all
> > 1s.
> >
> > For example, consider the below binary matrix.
> >
> >0  1  1  0  1
> >1  1  0  1  0
> >0  1  1  1  0
> >1  1  1  1  0
> >1  1  1  1  1
> >0  0  0  0  0
> >
> > then a 3x3 1 matrix eists
> >
> > the second question is .. if such a matrix (square matrix does not
> > exist) find one with maximum 1s .
> >
> > --
> > thanks
> > --mac
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] binary matrix

2010-10-04 Thread mac adobe
Given a binary matrix, find out the maximum size square sub-matrix with all
1s.

For example, consider the below binary matrix.

   0  1  1  0  1
   1  1  0  1  0
   0  1  1  1  0
   1  1  1  1  0
   1  1  1  1  1
   0  0  0  0  0


then a 3x3 1 matrix eists


the second question is .. if such a matrix (square matrix does not
exist) find one with maximum 1s .


-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] repeating numbers in an array

2010-10-02 Thread mac adobe
how will this give me array_1 which lists all numbers comming 1 time ,
array_2 which lists all numbers comming 2  time  etc ?


On Sun, Oct 3, 2010 at 11:31 AM, kusuma sanjeev wrote:

> One possible solution would be to create an array of pointers to the list..
> array index indicates how many times the element occurs and the list gives
> the elements.
>
>
> On Sun, Oct 3, 2010 at 11:22 AM, sharad kumar wrote:
>
>> it will take same amount of memory nakey value is element and vaule is
>> the amount of times element occurs.
>>
>>
>> On Sun, Oct 3, 2010 at 11:11 AM, mac adobe  wrote:
>>
>>> i think hash map takes lots of memory ...  please correct me if i am
>>> wrong here ..
>>>
>>> anyways its a soluton but i would like to have a different solution .. :)
>>>
>>>
>>> --mac
>>>
>>>
>>> On Sun, Oct 3, 2010 at 10:55 AM, sharad kumar 
>>> wrote:
>>>
>>>> cant u use a hash map buddy???
>>>>
>>>>   On Sun, Oct 3, 2010 at 10:35 AM, mac adobe wrote:
>>>>
>>>>>  You are given a very long array of integers . Some number in this
>>>>> integer array come 1 time , some 2 times some 3 times . create 3 different
>>>>> arrays .
>>>>> Array 1 will have numbers with numbers comming only1 time , Array 2
>>>>> will have numbers with numbers comming 2  times, Array 3 will have numbers
>>>>> with numbers repearting 3 times ,
>>>>>
>>>>>
>>>>> Can you extend the solution to create array_x with elements  repeating
>>>>> x times ?
>>>>>
>>>>> thanks
>>>>> --mac
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> yezhu malai vaasa venkataramana Govinda Govinda
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> yezhu malai vaasa venkataramana Govinda Govinda
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Rgds,
> Kusuma S
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] repeating numbers in an array

2010-10-02 Thread mac adobe
i think hash map takes lots of memory ...  please correct me if i am wrong
here ..

anyways its a soluton but i would like to have a different solution .. :)

--mac

On Sun, Oct 3, 2010 at 10:55 AM, sharad kumar wrote:

> cant u use a hash map buddy???
>
> On Sun, Oct 3, 2010 at 10:35 AM, mac adobe  wrote:
>
>> You are given a very long array of integers . Some number in this integer
>> array come 1 time , some 2 times some 3 times . create 3 different arrays .
>>
>> Array 1 will have numbers with numbers comming only1 time , Array 2 will
>> have numbers with numbers comming 2  times, Array 3 will have numbers with
>> numbers repearting 3 times ,
>>
>>
>> Can you extend the solution to create array_x with elements  repeating x
>> times ?
>>
>> thanks
>> --mac
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> yezhu malai vaasa venkataramana Govinda Govinda
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] repeating numbers in an array

2010-10-02 Thread mac adobe
You are given a very long array of integers . Some number in this integer
array come 1 time , some 2 times some 3 times . create 3 different arrays .
Array 1 will have numbers with numbers comming only1 time , Array 2 will
have numbers with numbers comming 2  times, Array 3 will have numbers with
numbers repearting 3 times ,


Can you extend the solution to create array_x with elements  repeating x
times ?

thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Minimum ladders required

2010-10-01 Thread mac adobe
@ Yang  .. can you please share book authors so that i can refer .. .

Please share some insight also .. it will help me understand it.

--mac

On Fri, Oct 1, 2010 at 4:01 PM, mac adobe  wrote:

> correcting ... Its minimum numbers of ladders required
>
>
>  Please suggest how you think for this problem
>  Suppose you have many airplanes . Each plane needs a ladder so
>  that people can board the plane easily .
>  Now plane will land at time land_time and then fly away again at fly_time
> .
>  During this time , people will continue to board the plane and the
>  ladder should remain attached to the plane. So if plane lands at 3 am and
>  fly at 3 pm , we need a ladder from 3 am to 3 pm dedicated for that plane.
>  Given land_time and  fly_time of multiple planes in a day , find the
> minimum
>  number of ladders your require .
>
>
>  --mac
>
>
> On Fri, Oct 1, 2010 at 3:56 PM, Yan Wang wrote:
>
>> I think your question should be to find the minimum number of ladders
>> required.
>>
>> This is a very classic Greedy-Algorithm solved problem. Please refer
>> to Chapter 4 of book "Algorithm Design".
>>
>> On Fri, Oct 1, 2010 at 2:32 AM, mac adobe  wrote:
>> > Hi
>> > Please suggest how you think for this problem
>> > Suppose you have many airplanes . Each plane needs a ladder so
>> > that people can board the plane easily .
>> > Now plane will land at time land_time and then fly away again at
>> fly_time .
>> > During this time , people will continue to board the plane and the
>> > ladder should remain attached to the plane. So if plane lands at 3 am
>> and
>> > fly at 3 pm , we need a ladder from 3 am to 3 pm dedicated for that
>> plane.
>> > Given land_time and  fly_time of multiple planes in a day , find the
>> minimum
>> > number of ladders your require .
>> >
>> >
>> > --mac
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algoge...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > algogeeks+unsubscr...@googlegroups.com
>> .
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Minimum ladders required

2010-10-01 Thread mac adobe
correcting ... Its minimum numbers of ladders required


 Please suggest how you think for this problem
 Suppose you have many airplanes . Each plane needs a ladder so
 that people can board the plane easily .
 Now plane will land at time land_time and then fly away again at fly_time .
 During this time , people will continue to board the plane and the
 ladder should remain attached to the plane. So if plane lands at 3 am and
 fly at 3 pm , we need a ladder from 3 am to 3 pm dedicated for that plane.
 Given land_time and  fly_time of multiple planes in a day , find the
minimum
 number of ladders your require .


 --mac


On Fri, Oct 1, 2010 at 3:56 PM, Yan Wang  wrote:

> I think your question should be to find the minimum number of ladders
> required.
>
> This is a very classic Greedy-Algorithm solved problem. Please refer
> to Chapter 4 of book "Algorithm Design".
>
> On Fri, Oct 1, 2010 at 2:32 AM, mac adobe  wrote:
> > Hi
> > Please suggest how you think for this problem
> > Suppose you have many airplanes . Each plane needs a ladder so
> > that people can board the plane easily .
> > Now plane will land at time land_time and then fly away again at fly_time
> .
> > During this time , people will continue to board the plane and the
> > ladder should remain attached to the plane. So if plane lands at 3 am and
> > fly at 3 pm , we need a ladder from 3 am to 3 pm dedicated for that
> plane.
> > Given land_time and  fly_time of multiple planes in a day , find the
> minimum
> > number of ladders your require .
> >
> >
> > --mac
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] maximum ladders required

2010-10-01 Thread mac adobe
Hi

Please suggest how you think for this problem

Suppose you have many airplanes . Each plane needs a ladder so
that people can board the plane easily .
Now plane will land at time land_time and then fly away again at fly_time .
During this time , people will continue to board the plane and the
ladder should remain attached to the plane. So if plane lands at 3 am and
fly at 3 pm , we need a ladder from 3 am to 3 pm dedicated for that plane.

Given land_time and  fly_time of multiple planes in a day , find the maximum
number of ladders your require .



--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: BST in BT

2010-09-25 Thread mac adobe
@parody :..and how would that find me a maximum size BST ..  ??

( for checking if this BT is BST i would do inorder traversal and see if it
is increasing )



On Sun, Sep 26, 2010 at 11:10 AM, mac adobe  wrote:

> No parody .. that would be another  doubt :(
>
>
> On Sat, Sep 25, 2010 at 11:03 PM, prodigy <1abhishekshu...@gmail.com>wrote:
>
>> By maintaining a current maximum and a global maximum. You do know how
>> to verify  a BT is BST .
>>
>> http://pastebin.com/xwXXTEnP
>>
>> On Sep 25, 9:04 pm, mac adobe  wrote:
>> > How would you identify a binary search tree of maximum nodes in a binary
>> > tree ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: BST in BT

2010-09-25 Thread mac adobe
No parody .. that would be another  doubt :(

On Sat, Sep 25, 2010 at 11:03 PM, prodigy <1abhishekshu...@gmail.com> wrote:

> By maintaining a current maximum and a global maximum. You do know how
> to verify  a BT is BST .
>
> http://pastebin.com/xwXXTEnP
>
> On Sep 25, 9:04 pm, mac adobe  wrote:
> > How would you identify a binary search tree of maximum nodes in a binary
> > tree ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] BST in BT

2010-09-25 Thread mac adobe
How would you identify a binary search tree of maximum nodes in a binary
tree ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.