Re: [algogeeks] Re: 1s and 0s

2010-12-25 Thread Praveen Baskar
Your Second approach is cool :)

On Wed, Dec 22, 2010 at 1:06 PM, juver++  wrote:

> Use bits manipulation tricks.
> 1. There is a way to remove a group of consecutive 1's from the right: A =
> n & (n + 1). Then check if A==0 then OK.
> 2. Second approach: B=n+1, check if B & (B-1) (this checks if B is a power
> of 2, so it contains only 1 set bit) is zero then OK.
>
>  --
> 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.
>



-- 
B. Praveen

-- 
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] Programming Interview Questions

2010-12-04 Thread Praveen Baskar
Hi All

   Kindly refer the below website for programming interview questions.
   http://www.careercup.com/ 

Also please do refer the book "Cracking the Coding Interview".

Hope this info is very useful to you.

With Love
B. Praveen

-- 
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] BST Question

2010-10-24 Thread Praveen Baskar
oh ya thanks now i got it

On Sun, Oct 24, 2010 at 9:54 AM, preetika tyagi wrote:

> @Praveen- In this case, we will not ignore the right subtree of the root
> (-10, which is less than zero) while traversing the tree.
>
>
> On Sat, Oct 23, 2010 at 9:06 PM, Praveen Baskar 
> wrote:
>
>> i think it is possible nishaanth
>> please do take a look at this example
>>
>> -10
>>/\
>>  -11   8
>> /\
>>   -5 10
>>  -5 is greater than -10
>>
>>
>> On Sat, Oct 23, 2010 at 11:19 PM, nishaanth wrote:
>>
>>> @Praveenit is not possible..in a BST *all the nodes* on the right
>>> subtree are greater than the node :)
>>>
>>>
>>> On Sat, Oct 16, 2010 at 3:26 PM, Praveen Baskar >> > wrote:
>>>
>>>> @nishaanth: wat if the left child of the right node has a negative value
>>>>
>>>>
>>>> On Thu, Oct 14, 2010 at 11:12 AM, nishaanth wrote:
>>>>
>>>>>
>>>>>
>>>>>> Just see the value of the node at every point, if it is greater than
>>>>> zero dont recurse the right sub-tree, as simple as it is.print the node u
>>>>> inspected if it is less than zero.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> S.Nishaanth,
>>>>> Computer Science and engineering,
>>>>> IIT Madras.
>>>>>
>>>>>  --
>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> By B. Praveen
>>>>
>>>>  --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> S.Nishaanth,
>>> Computer Science and engineering,
>>> IIT Madras.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> By B. Praveen
>>
>> --
>> 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.
>



-- 
By B. Praveen

-- 
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] BST Question

2010-10-23 Thread Praveen Baskar
i think it is possible nishaanth
please do take a look at this example

-10
   /\
 -11   8
/\
  -5 10
 -5 is greater than -10


On Sat, Oct 23, 2010 at 11:19 PM, nishaanth  wrote:

> @Praveenit is not possible..in a BST *all the nodes* on the right
> subtree are greater than the node :)
>
>
> On Sat, Oct 16, 2010 at 3:26 PM, Praveen Baskar 
> wrote:
>
>> @nishaanth: wat if the left child of the right node has a negative value
>>
>> On Thu, Oct 14, 2010 at 11:12 AM, nishaanth wrote:
>>
>>>
>>>
>>>> Just see the value of the node at every point, if it is greater than
>>> zero dont recurse the right sub-tree, as simple as it is.print the node u
>>> inspected if it is less than zero.
>>>
>>>
>>>
>>>
>>> --
>>> S.Nishaanth,
>>> Computer Science and engineering,
>>> IIT Madras.
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> By B. Praveen
>>
>>  --
>> 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.
>>
>
>
>
> --
> S.Nishaanth,
> Computer Science and engineering,
> IIT Madras.
>
> --
> 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.
>



-- 
By B. Praveen

-- 
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] BST Question

2010-10-16 Thread Praveen Baskar
@nishaanth: wat if the left child of the right node has a negative value

On Thu, Oct 14, 2010 at 11:12 AM, nishaanth  wrote:

>
>
>> Just see the value of the node at every point, if it is greater than zero
> dont recurse the right sub-tree, as simple as it is.print the node u
> inspected if it is less than zero.
>
>
>
>
> --
> S.Nishaanth,
> Computer Science and engineering,
> IIT Madras.
>
>  --
> 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.
>



-- 
By B. Praveen

-- 
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] Point lies inside or outside of triangle?

2010-09-20 Thread Praveen Baskar
here is the hint
we can easily solve this

draw a triangle
draw a point is inside the triangle
connect the three vertices of the triangle with this point
you will get three small triangle

if ( area(big triangle)== sum of area of small triangles) then the point is
inside the triangle else it is outside the triangle


On Mon, Sep 20, 2010 at 10:02 PM, umesh  wrote:

> Initially we have given  three point A , B, C in plane represent three
> nodes of triangle, now given another point Z  which lies in same
> plane,  find out whether that point lies on/inside the triangle or
> outside of triangletry to get in minimum time and space
> complexity
>
>
> --
> Thanks & Regards
>
> Umesh kewat
>
> --
> 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.
>
>


-- 
By B. Praveen

-- 
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: Amazon Question

2010-09-13 Thread Praveen Baskar
i think that we have to generate substrings from the given string such that
the similarity is above 50%
for eg.
word ="foo"
we have to generate the strings which must be greater than half of the given
string length
{"fo","oo"} (in this case)

after this operation we have the following string set {"foo","fo","oo"}

then we can doselect* from product where name like '%foo%'select*
from product where name like '%fo%'. select* from product where name
like '%oo%'


please do correct me if i am wrong
On Mon, Sep 13, 2010 at 1:01 PM, SVIX wrote:

> select * from product
> where
> name like '%foo%'
> and len(name) <=6;
>
> btw, how do u define similarity? i'm guessing it wouldn't be this
> simple...
>
> On Sep 12, 5:12 am, Snoopy Me  wrote:
> > You are given the amazon.com database which consists of names of
> > millions of products. When a user enters a search query for particular
> > object with the keyword say "foo" , output all the products which have
> > names having 50% or more similarity with the given keyword ie "foo"
> >
> > Write the most efficient algorithm for the same.
>
> --
> 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.
>
>


-- 
By B. Praveen

-- 
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] cyclic String

2010-09-11 Thread Praveen Baskar
str="hello";
str1="lloeh";
if (str+str).subString(str1) is true then the string is cyclic string of
another

On Sat, Sep 11, 2010 at 1:52 PM, bittu  wrote:

> How will you check if a string is cyclic string of another
>
> solution O(n)..???/?? or even less compraiosn..
>
> --
> 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.
>
>


-- 
By B. Praveen

-- 
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.