Re: [algogeeks] Opening @ Microsoft Hyd

2015-06-11 Thread ~*~VICKY~*~
Yes, please forward me your resume .

On Thu, Jun 11, 2015 at 3:20 PM, Abhijeet Srivastva <
nwaab.abhij...@gmail.com> wrote:

> Hi Venkat,
> I have total 7 years of work experience in core development and currently
> working in one of the top Product development company.
> Please let me know how can i apply for the position.
>
> Regards,
> Abhijeet Srivastava
> 0987114705
>
> On Sat, Jun 6, 2015 at 12:40 PM, ~*~VICKY~*~ 
> wrote:
>
>> Hi,
>>
>> <>
>>
>> My team is expanding and is looking for strong devs with deep
>> understanding of basics and problem solving skills. The openings are in
>> Hyderabad for which will be doing a walk-in interview in Bangalore over
>> third week of this month.  If you think you can take up the challenge of
>> redesigning and optimizing the cloud computing world, send me your resumes
>> (preferably one page resume) to give a shot at this great opportunity.
>>
>> PS : No freshers please, Minimum experience of 2 years preferably.
>> --
>> Cheers,
>>
>>   Vicky
>>
>> --
>> 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.
>



-- 
Cheers,

  Vicky

-- 
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] Opening @ Microsoft Hyd

2015-06-06 Thread ~*~VICKY~*~
Hi,

<>

My team is expanding and is looking for strong devs with deep understanding
of basics and problem solving skills. The openings are in Hyderabad for
which will be doing a walk-in interview in Bangalore over third week of
this month.  If you think you can take up the challenge of redesigning and
optimizing the cloud computing world, send me your resumes (preferably one
page resume) to give a shot at this great opportunity.

PS : No freshers please, Minimum experience of 2 years preferably.
-- 
Cheers,

  Vicky

-- 
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: Opening in Microsoft India Development center, hyderabad.

2015-01-31 Thread ~*~VICKY~*~
Missed to add, preferably 1 year+ experience.

On Sat, Jan 31, 2015 at 3:26 PM, ~*~VICKY~*~ 
wrote:

> Hi folks,
>
> My team is expanding and looking for strong devs with deep understanding
> of basics. If you think you can take up the challenge of redesigning and
> optimizing the cloud computing world, send me your resumes (preferably one
> page resume) to give a shot at this great opportunity.
>
> Some links about the team
> http://www.microsoft.com/about/technicalrecognition/Autopilot.aspx
> http://www.theregister.co.uk/2014/02/07/microsoft_autopilot_feature/
>
> --
> Cheers,
>
>   Vicky
>



-- 
Cheers,

  Vicky

-- 
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] Opening in Microsoft India Development center, hyderabad.

2015-01-31 Thread ~*~VICKY~*~
Hi folks,

My team is expanding and looking for strong devs with deep understanding of
basics. If you think you can take up the challenge of redesigning and
optimizing the cloud computing world, send me your resumes (preferably one
page resume) to give a shot at this great opportunity.

Some links about the team
http://www.microsoft.com/about/technicalrecognition/Autopilot.aspx
http://www.theregister.co.uk/2014/02/07/microsoft_autopilot_feature/

-- 
Cheers,

  Vicky

-- 
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] Regex tester

2012-12-27 Thread ~*~VICKY~*~
I'm giving you a simple recursive code which i wrote long back. Please let
me know if it fails for any cases. Ignore the funny cout's It used to help
me debug and i'm lazy to remove it. :P :)

#include
#include
using namespace std;
/*
abasjc a*c
while(pattern[j] == '*' text[i] == pattern[j]) {i++; j++}
*/
bool match(string text, string pattern, int x, int y)
{
if(pattern.length() == y)
{
cout<<"hey\n";
return 1;
}
if(text.length() == x)
{
cout<<"shit\n";
return 0;
}
if(pattern[y] == '.' || text[x] == pattern[y])
{
cout<<"in match"<> text >> pattern;
cout << match(text, pattern,0, 0);
}

On Thu, Dec 27, 2012 at 6:10 PM, shady  wrote:

> Thanks for the link Ritesh,
> if (isMatch(s, p+2)) return true;
> isnt this line incorrect in the code, as it can lead to segmentation
> fault... how can we directly access p+2 element, we know for sure that p is
> not '\0', but p+1 element can be '\0' , therefore leading to p+2 to be
> undefined.
>
> On Thu, Dec 27, 2012 at 6:23 AM, Ritesh Mishra  wrote:
>
>> try to solve it by recursion ..
>> http://www.leetcode.com/2011/09/regular-expression-matching.html
>>
>>
>>  Regards,
>>
>> Ritesh Kumar Mishra
>> Information Technology
>> Third Year Undergraduate
>> MNNIT Allahabad
>>
>>
>> On Sun, Dec 23, 2012 at 11:14 PM, Prem Krishna Chettri <
>> hprem...@gmail.com> wrote:
>>
>>> Well I can tell you Something about design pattern to  solve this case..
>>>
>>>What I mean is by using The State Machine Design Pattern, Anyone
>>> can solve this. but Ofcourse it is complicated.
>>>
>>>
>>>
>>>
>>> On Sun, Dec 23, 2012 at 11:01 PM, shady  wrote:
>>>
>>>> that's the point, Have to implement it from scratch... otherwise java
>>>> has regex and matcher, pattern to solve it...
>>>>
>>>>
>>>> On Sun, Dec 23, 2012 at 10:28 PM, saurabh singh wrote:
>>>>
>>>>> If you need to implement this for some project then python and java
>>>>> have a very nice library
>>>>>
>>>>>
>>>>> Saurabh Singh
>>>>> B.Tech (Computer Science)
>>>>> MNNIT
>>>>> blog:geekinessthecoolway.blogspot.com
>>>>>
>>>>>
>>>>> On Sun, Dec 23, 2012 at 7:48 PM, shady  wrote:
>>>>>
>>>>>>
>>>>>> http://stackoverflow.com/questions/13144590/to-check-if-two-strings-match-with-alphabets-digits-and-special-characters
>>>>>>
>>>>>> any solution for this. we need to implement such regex
>>>>>> tester
>>>>>>
>>>>>> some complex cases :
>>>>>> *string** regex *   ->   * status*
>>>>>> *
>>>>>> *
>>>>>> reesd   re*.d  ->   match
>>>>>> re*eed reeed ->   match
>>>>>>
>>>>>> can some one help with this ?
>>>>>>
>>>>>>  --
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>  --
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>>>
>>>>
>>>>
>>>
>>>  --
>>>
>>>
>>>
>>
>>  --
>>
>>
>>
>
>  --
>
>
>



-- 
Cheers,

  Vicky

-- 




[algogeeks] Facebook phone interview questions

2012-10-05 Thread ~*~VICKY~*~
Hi guys pls share the quest you know that was asked in facebook phone
interview. Thank you.

-- 
Cheers,

  Vicky

-- 
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 an OO representation to model HTML.

2012-10-01 Thread ~*~VICKY~*~
Could someone throw some light on this OOPS question. I detailed
explanation would be of immense help.

Design an OO representation to model HTML.
How do they represent tags and content? What about containment
relationships? Bonus points if they know that this has already been done a
bunch of times, e.g. with DOM. But they still have to describe it.


-- 
Cheers,

  Vicky

-- 
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] Constant time solution needed

2012-08-14 Thread ~*~VICKY~*~
Hey I just gave an idea, I believe solve it yourself :) I appreciate your
effort.

On Tue, Aug 14, 2012 at 4:34 PM, Kailash Bagaria  wrote:

> @vicky
> your approach doesn't work for  (x1,y1) = (1,2)
>   (x2,y2) = (2,3)
>
> By your Approach:-
>   Ans= sumArray[x2][y2] - sumArray[x1][y1] +
> ip[x1][y1]=66-18+6=*54*
> But Actual Ans is 6+7+10+11=*34*
>
> On Sun, Aug 12, 2012 at 8:19 PM, ~*~VICKY~*~ wrote:
>
>> Lets build the array for the example you gave.
>>
>> i/p:
>>
>> 0 1 2 3
>> 4 5  6 7
>> 8 9 10 11
>>
>> (x1,y1) = (0,0)
>> (x2,y2) = (1,2)
>> sumArray
>> 0  1 23
>> 4  10  18   28
>> 12 27  45  66
>> (will take O(n^2) to build above array)
>> So now when you get coordinates as input, you can calc the sum by
>>
>> Ans = sumArray[x2][y2] - sumArray[x1][y1] + ip[x1][y1]
>>
>> For our case it will be Ans = 18-0+0 = 18
>>
>> Please lemme know if any bugs with the logic.
>>
>>
>> On Sun, Aug 12, 2012 at 6:27 PM, Srividhya Sampath <
>> srisam261...@gmail.com> wrote:
>>
>>>
>>> @ Vicky
>>>
>>> Can yo explain with an illustration ?
>>>
>>>
>>> On Sat, Aug 11, 2012 at 10:07 PM, ~*~VICKY~*~ 
>>> wrote:
>>>
>>>> May be you can consider creating a 2d array to pre process and store
>>>> all the rectangle sums as a dependent subproblem, the sum of larger rect
>>>> will be currValuesAdded+OldRectSum. So when you get the coordinate as input
>>>> u can calc the needed sum by subtracting sum of big rect and small rect
>>>> which is not included in the given coordinates. This can be called constant
>>>> time if u don't include the preprocessing time.
>>>>
>>>>
>>>> On Sat, Aug 11, 2012 at 9:57 PM, adarsh kumar wrote:
>>>>
>>>>> Sum of the integers meaning? Do you mind giving an example test case?
>>>>>
>>>>> regards.
>>>>>
>>>>> On Sat, Aug 11, 2012 at 7:10 PM, Srividhya wrote:
>>>>>
>>>>>> hi all:)
>>>>>>
>>>>>> The coordinates of a rectangle will be specified. there is a matrix
>>>>>> of integers. yo should find the sum of the integers that fall in the 
>>>>>> region
>>>>>> specified by the  coordinates .
>>>>>>
>>>>>> The solution to be in constant time .
>>>>>>
>>>>>> --
>>>>>> 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/-/qHSmXBshmS4J.
>>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>>
>>>>   Vicky
>>>>
>>>>  --
>>>> 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.

Re: [algogeeks] Constant time solution needed

2012-08-13 Thread ~*~VICKY~*~
Its something which is good to have discussion with the interviewer rather
than making any assumption. :)

On Mon, Aug 13, 2012 at 6:07 PM, Srividhya Sampath
wrote:

> @vicky
>
> Got it . thanks ..is it possible to ignore the preprocessing time when
> calculating time complexity?
>
>
>
> On Sun, Aug 12, 2012 at 10:02 PM, shady  wrote:
>
>> @venkat +1
>>
>> On Sun, Aug 12, 2012 at 9:09 PM, ~*~VICKY~*~ wrote:
>>
>>> @Arun: This approach is constant time once the array is build for any
>>> queries that follows. :) You know sum for all possible rectangles in the
>>> given 2d array thats makes it better than computing sum for each input.
>>> Hope it makes sense
>>>
>>>
>>> On Sun, Aug 12, 2012 at 9:07 PM, ~*~VICKY~*~ wrote:
>>>
>>>> Fine, the basic idea of using dp here is sum of each rectangle is a
>>>> dependent sub problem. So when u find sum for smaller rectangle we can use
>>>> it to compute sum of bigger rectangle with new coordinates added to
>>>> previous small rectangle. So u can compute the sum array by using this
>>>> formula
>>>>
>>>> sum[i][j] = sum[i-1][j-1] + (sum[i-1][j] - sum[i-1][j-1]) +
>>>> (sum[i][j-1] - sum[i-1][j-1])+ip[i][j]
>>>> [smaller rect]   [that row sum value][that
>>>> col sum value]
>>>>
>>>>
>>>>
>>>> On Sun, Aug 12, 2012 at 8:54 PM, Srividhya Sampath <
>>>> srisam261...@gmail.com> wrote:
>>>>
>>>>> @vicky
>>>>>
>>>>> can yo explain the logic behind the 'Sum Array' computation (if
>>>>> possible elaborately )?
>>>>>
>>>>>
>>>>> On Sun, Aug 12, 2012 at 8:19 PM, ~*~VICKY~*~ 
>>>>> wrote:
>>>>>
>>>>>> Lets build the array for the example you gave.
>>>>>>
>>>>>> i/p:
>>>>>>
>>>>>> 0 1 2 3
>>>>>> 4 5  6 7
>>>>>> 8 9 10 11
>>>>>>
>>>>>> (x1,y1) = (0,0)
>>>>>> (x2,y2) = (1,2)
>>>>>> sumArray
>>>>>> 0  1 23
>>>>>> 4  10  18   28
>>>>>> 12 27  45  66
>>>>>> (will take O(n^2) to build above array)
>>>>>> So now when you get coordinates as input, you can calc the sum by
>>>>>>
>>>>>> Ans = sumArray[x2][y2] - sumArray[x1][y1] + ip[x1][y1]
>>>>>>
>>>>>> For our case it will be Ans = 18-0+0 = 18
>>>>>>
>>>>>> Please lemme know if any bugs with the logic.
>>>>>>
>>>>>>
>>>>>> On Sun, Aug 12, 2012 at 6:27 PM, Srividhya Sampath <
>>>>>> srisam261...@gmail.com> wrote:
>>>>>>
>>>>>>>
>>>>>>> @ Vicky
>>>>>>>
>>>>>>> Can yo explain with an illustration ?
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Aug 11, 2012 at 10:07 PM, ~*~VICKY~*~ <
>>>>>>> venkat.jun...@gmail.com> wrote:
>>>>>>>
>>>>>>>> May be you can consider creating a 2d array to pre process and
>>>>>>>> store all the rectangle sums as a dependent subproblem, the sum of 
>>>>>>>> larger
>>>>>>>> rect will be currValuesAdded+OldRectSum. So when you get the 
>>>>>>>> coordinate as
>>>>>>>> input u can calc the needed sum by subtracting sum of big rect and 
>>>>>>>> small
>>>>>>>> rect which is not included in the given coordinates. This can be called
>>>>>>>> constant time if u don't include the preprocessing time.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Aug 11, 2012 at 9:57 PM, adarsh kumar 
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Sum of the integers meaning? Do you mind giving an example test
>>>>>>>>> case?
>>>>>>>>>
>>>>>>>>> regards.
>>>>>>>>>
>>>>>>>>> On Sat, Aug 11, 2012 at 7:10 PM, Srividhya >>>>>>>> > wrote:
>>>>>>>>>
>>&

Re: [algogeeks] Constant time solution needed

2012-08-12 Thread ~*~VICKY~*~
@Arun: This approach is constant time once the array is build for any
queries that follows. :) You know sum for all possible rectangles in the
given 2d array thats makes it better than computing sum for each input.
Hope it makes sense

On Sun, Aug 12, 2012 at 9:07 PM, ~*~VICKY~*~ wrote:

> Fine, the basic idea of using dp here is sum of each rectangle is a
> dependent sub problem. So when u find sum for smaller rectangle we can use
> it to compute sum of bigger rectangle with new coordinates added to
> previous small rectangle. So u can compute the sum array by using this
> formula
>
> sum[i][j] = sum[i-1][j-1] + (sum[i-1][j] - sum[i-1][j-1]) + (sum[i][j-1] -
> sum[i-1][j-1])+ip[i][j]
> [smaller rect]   [that row sum value][that col
> sum value]
>
>
>
> On Sun, Aug 12, 2012 at 8:54 PM, Srividhya Sampath  > wrote:
>
>> @vicky
>>
>> can yo explain the logic behind the 'Sum Array' computation (if possible
>> elaborately )?
>>
>>
>> On Sun, Aug 12, 2012 at 8:19 PM, ~*~VICKY~*~ wrote:
>>
>>> Lets build the array for the example you gave.
>>>
>>> i/p:
>>>
>>> 0 1 2 3
>>> 4 5  6 7
>>> 8 9 10 11
>>>
>>> (x1,y1) = (0,0)
>>> (x2,y2) = (1,2)
>>> sumArray
>>> 0  1 23
>>> 4  10  18   28
>>> 12 27  45  66
>>> (will take O(n^2) to build above array)
>>> So now when you get coordinates as input, you can calc the sum by
>>>
>>> Ans = sumArray[x2][y2] - sumArray[x1][y1] + ip[x1][y1]
>>>
>>> For our case it will be Ans = 18-0+0 = 18
>>>
>>> Please lemme know if any bugs with the logic.
>>>
>>>
>>> On Sun, Aug 12, 2012 at 6:27 PM, Srividhya Sampath <
>>> srisam261...@gmail.com> wrote:
>>>
>>>>
>>>> @ Vicky
>>>>
>>>> Can yo explain with an illustration ?
>>>>
>>>>
>>>> On Sat, Aug 11, 2012 at 10:07 PM, ~*~VICKY~*~ 
>>>> wrote:
>>>>
>>>>> May be you can consider creating a 2d array to pre process and store
>>>>> all the rectangle sums as a dependent subproblem, the sum of larger rect
>>>>> will be currValuesAdded+OldRectSum. So when you get the coordinate as 
>>>>> input
>>>>> u can calc the needed sum by subtracting sum of big rect and small rect
>>>>> which is not included in the given coordinates. This can be called 
>>>>> constant
>>>>> time if u don't include the preprocessing time.
>>>>>
>>>>>
>>>>> On Sat, Aug 11, 2012 at 9:57 PM, adarsh kumar wrote:
>>>>>
>>>>>> Sum of the integers meaning? Do you mind giving an example test case?
>>>>>>
>>>>>> regards.
>>>>>>
>>>>>> On Sat, Aug 11, 2012 at 7:10 PM, Srividhya wrote:
>>>>>>
>>>>>>> hi all:)
>>>>>>>
>>>>>>> The coordinates of a rectangle will be specified. there is a matrix
>>>>>>> of integers. yo should find the sum of the integers that fall in the 
>>>>>>> region
>>>>>>> specified by the  coordinates .
>>>>>>>
>>>>>>> The solution to be in constant time .
>>>>>>>
>>>>>>> --
>>>>>>> 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/-/qHSmXBshmS4J.
>>>>>>> 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 gro

Re: [algogeeks] Constant time solution needed

2012-08-12 Thread ~*~VICKY~*~
Fine, the basic idea of using dp here is sum of each rectangle is a
dependent sub problem. So when u find sum for smaller rectangle we can use
it to compute sum of bigger rectangle with new coordinates added to
previous small rectangle. So u can compute the sum array by using this
formula

sum[i][j] = sum[i-1][j-1] + (sum[i-1][j] - sum[i-1][j-1]) + (sum[i][j-1] -
sum[i-1][j-1])+ip[i][j]
[smaller rect]   [that row sum value][that col
sum value]



On Sun, Aug 12, 2012 at 8:54 PM, Srividhya Sampath
wrote:

> @vicky
>
> can yo explain the logic behind the 'Sum Array' computation (if possible
> elaborately )?
>
>
> On Sun, Aug 12, 2012 at 8:19 PM, ~*~VICKY~*~ wrote:
>
>> Lets build the array for the example you gave.
>>
>> i/p:
>>
>> 0 1 2 3
>> 4 5  6 7
>> 8 9 10 11
>>
>> (x1,y1) = (0,0)
>> (x2,y2) = (1,2)
>> sumArray
>> 0  1 23
>> 4  10  18   28
>> 12 27  45  66
>> (will take O(n^2) to build above array)
>> So now when you get coordinates as input, you can calc the sum by
>>
>> Ans = sumArray[x2][y2] - sumArray[x1][y1] + ip[x1][y1]
>>
>> For our case it will be Ans = 18-0+0 = 18
>>
>> Please lemme know if any bugs with the logic.
>>
>>
>> On Sun, Aug 12, 2012 at 6:27 PM, Srividhya Sampath <
>> srisam261...@gmail.com> wrote:
>>
>>>
>>> @ Vicky
>>>
>>> Can yo explain with an illustration ?
>>>
>>>
>>> On Sat, Aug 11, 2012 at 10:07 PM, ~*~VICKY~*~ 
>>> wrote:
>>>
>>>> May be you can consider creating a 2d array to pre process and store
>>>> all the rectangle sums as a dependent subproblem, the sum of larger rect
>>>> will be currValuesAdded+OldRectSum. So when you get the coordinate as input
>>>> u can calc the needed sum by subtracting sum of big rect and small rect
>>>> which is not included in the given coordinates. This can be called constant
>>>> time if u don't include the preprocessing time.
>>>>
>>>>
>>>> On Sat, Aug 11, 2012 at 9:57 PM, adarsh kumar wrote:
>>>>
>>>>> Sum of the integers meaning? Do you mind giving an example test case?
>>>>>
>>>>> regards.
>>>>>
>>>>> On Sat, Aug 11, 2012 at 7:10 PM, Srividhya wrote:
>>>>>
>>>>>> hi all:)
>>>>>>
>>>>>> The coordinates of a rectangle will be specified. there is a matrix
>>>>>> of integers. yo should find the sum of the integers that fall in the 
>>>>>> region
>>>>>> specified by the  coordinates .
>>>>>>
>>>>>> The solution to be in constant time .
>>>>>>
>>>>>> --
>>>>>> 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/-/qHSmXBshmS4J.
>>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>>
>>>>   Vicky
>>>>
>>>>  --
>>>> 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.
>>>>
>>&g

Re: [algogeeks] Constant time solution needed

2012-08-12 Thread ~*~VICKY~*~
@Arun: How do you claim your solution to be constant time? :P

On Sun, Aug 12, 2012 at 8:46 PM, Arun Kindra  wrote:

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



-- 
Cheers,

  Vicky

-- 
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] Constant time solution needed

2012-08-12 Thread ~*~VICKY~*~
Lets build the array for the example you gave.

i/p:

0 1 2 3
4 5  6 7
8 9 10 11

(x1,y1) = (0,0)
(x2,y2) = (1,2)
sumArray
0  1 23
4  10  18   28
12 27  45  66
(will take O(n^2) to build above array)
So now when you get coordinates as input, you can calc the sum by

Ans = sumArray[x2][y2] - sumArray[x1][y1] + ip[x1][y1]

For our case it will be Ans = 18-0+0 = 18

Please lemme know if any bugs with the logic.


On Sun, Aug 12, 2012 at 6:27 PM, Srividhya Sampath
wrote:

>
> @ Vicky
>
> Can yo explain with an illustration ?
>
>
> On Sat, Aug 11, 2012 at 10:07 PM, ~*~VICKY~*~ wrote:
>
>> May be you can consider creating a 2d array to pre process and store all
>> the rectangle sums as a dependent subproblem, the sum of larger rect will
>> be currValuesAdded+OldRectSum. So when you get the coordinate as input u
>> can calc the needed sum by subtracting sum of big rect and small rect which
>> is not included in the given coordinates. This can be called constant time
>> if u don't include the preprocessing time.
>>
>>
>> On Sat, Aug 11, 2012 at 9:57 PM, adarsh kumar  wrote:
>>
>>> Sum of the integers meaning? Do you mind giving an example test case?
>>>
>>> regards.
>>>
>>> On Sat, Aug 11, 2012 at 7:10 PM, Srividhya wrote:
>>>
>>>> hi all:)
>>>>
>>>> The coordinates of a rectangle will be specified. there is a matrix of
>>>> integers. yo should find the sum of the integers that fall in the region
>>>> specified by the  coordinates .
>>>>
>>>> The solution to be in constant time .
>>>>
>>>> --
>>>> 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/-/qHSmXBshmS4J.
>>>> 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.
>>>
>>
>>
>>
>> --
>> Cheers,
>>
>>   Vicky
>>
>>  --
>> 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.
>



-- 
Cheers,

  Vicky

-- 
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] INTRVIEW QUESTION

2012-08-12 Thread ~*~VICKY~*~
Always share code using ideone like sites or discuss the algo approach.
Attaching code isn't the best idea is my personal feeling.

Regards,
Vicky

On Sun, Aug 12, 2012 at 12:44 AM, Ankit Singh wrote:

> if i am correctly understand the problem den i hv attchd the solution..
>
>
> On Sun, Aug 12, 2012 at 12:40 AM, Ankit Singh wrote:
>
>> is output is depend on no of digits in a number like 123 example for odd
>> no of digits and 121224 example for even digits???
>>
>> can you make it clear pls??
>>
>> On Sat, Aug 11, 2012 at 5:22 PM, payal gupta  wrote:
>>
>>> Given the start and an ending integer as user input, generate all
>>> integers with the following property.
>>> Example : 123 , 1+2 = 3 , valid number
>>> 121224 12+12 = 24 , valid number
>>> 1235 1+2 = 3 , 2+3 = 5 , valid number
>>> 125 1+2 <5 , invalid number
>>>
>>> --
>>> 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/-/zeZVnoP0sOEJ.
>>> 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.
>



-- 
Cheers,

  Vicky

-- 
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] Constant time solution needed

2012-08-11 Thread ~*~VICKY~*~
May be you can consider creating a 2d array to pre process and store all
the rectangle sums as a dependent subproblem, the sum of larger rect will
be currValuesAdded+OldRectSum. So when you get the coordinate as input u
can calc the needed sum by subtracting sum of big rect and small rect which
is not included in the given coordinates. This can be called constant time
if u don't include the preprocessing time.

On Sat, Aug 11, 2012 at 9:57 PM, adarsh kumar  wrote:

> Sum of the integers meaning? Do you mind giving an example test case?
>
> regards.
>
> On Sat, Aug 11, 2012 at 7:10 PM, Srividhya  wrote:
>
>> hi all:)
>>
>> The coordinates of a rectangle will be specified. there is a matrix of
>> integers. yo should find the sum of the integers that fall in the region
>> specified by the  coordinates .
>>
>> The solution to be in constant time .
>>
>> --
>> 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/-/qHSmXBshmS4J.
>> 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.
>



-- 
Cheers,

  Vicky

-- 
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] Data Cache implementation problem

2012-08-11 Thread ~*~VICKY~*~
It very much looks to be max heap with frequency as value. So maximum
frequent item will be the root and so on. O(logN) complexity for search

On Sat, Aug 11, 2012 at 1:18 PM, Navin Kumar wrote:

> I think best data structure would be "Optimal BST"
>
>
> On Fri, Aug 10, 2012 at 11:47 PM, Kumar Vishal  wrote:
>
>>  Huffman tree ???
>>
>>
>> On Fri, Aug 10, 2012 at 11:38 PM, Varma Selvaraj wrote:
>>
>>> A data cache needs to be implemented for the top 100 data items selected
>>> based on their frequency of access.
>>> The most frequent data member must be accessed  fastest. And the access
>>> time/iterations of each data member from the cache should correspond to the
>>> frequncy of its access.
>>>
>>> Please choose the right data structure and find the right algorithm for
>>> the scenario? Can anyone help on this question?
>>>
>>>
>>> Thanks and Regards,
>>> Varma
>>>
>>>  --
>>> 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
>> Kumar Vishal
>> _
>> *http://wethecommonpeople.wordpress.com/   *
>> *h**ttp://kumartechnicalarticles.wordpress.com/<http://kumartechnicalarticles.wordpress.com/>
>> *
>> _
>>
>>
>>  --
>> 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.
>



-- 
Cheers,

  Vicky

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

2012-08-11 Thread ~*~VICKY~*~
Can you share the coding questions asked. Thank you.

On Fri, Aug 10, 2012 at 10:29 PM, Abhishek Kumar wrote:

> two coding Qs + some mcqs(more than 1 option correct),time is 1.5 hr..
>
>
> On Fri, Aug 10, 2012 at 4:06 PM, deepikaanand wrote:
>
>> Somebody from DCE plz tell the paper pattern of google...
>>
>> --
>> 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/-/BjLRVjRlekIJ.
>> 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.
>



-- 
Cheers,

  Vicky

-- 
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 strange doubt with cpp class. Why compile error ?

2012-03-09 Thread ~*~VICKY~*~
#include
using namespace std;
class Abc
{

public :
int i;
Abc(){ i = 0;}

};
int main()
{ Abc a = new Abc();
cout

[algogeeks] Re: Time Complexity

2011-11-19 Thread ((** VICKY **))
Its level order traversal but its O(n^2) u search entire tree to check
if the nodes level is i (say 0<= i <= height). i guess can use stack
or queue to get O(n) complexity

On Nov 19, 2:58 pm, shady  wrote:
> this doesn't seem like level order printing, because you are simply
> printing the tree starting with the children as the root node.
>
> On Sat, Nov 19, 2011 at 12:57 PM, Ankuj Gupta  wrote:
> > What is the time complexity of this code for Level Order Traversal.
>
> > void printLevel(BinaryTree *p, int level) {
> >  if (!p) return;
> >  if (level == 1) {
> >    cout << p->data << " ";
> >  } else {
> >    printLevel(p->left, level-1);
> >    printLevel(p->right, level-1);
> >  }
> > }
>
> > void printLevelOrder(BinaryTree *root) {
> >  int height = maxHeight(root);
> >  for (int level = 1; level <= height; level++) {
> >    printLevel(root, level);
> >    cout << endl;
> >  }
> > }
>
> > My guess is NlogN if tree is balanced if not it will be N^2.
>
> > --
> > 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.



[algogeeks] Re: COA Question

2011-11-19 Thread ((** VICKY **))
I guess it could be.
b) position independent code
Keeping relative addressing facilates address independent code as its
always relative. correct me if am wrong.!


On Nov 18, 4:07 pm, Vijay Khandar  wrote:
> Relative mode of addressing is most relevant to writing
> a)coroutines
> b)position-independent code
> c)shareble code
> d)interrupt handlers
>
> plz anyone give me answer with explation...

-- 
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: Computer Organisation Q

2011-11-17 Thread ((** VICKY **))
False not necessarily.

On Nov 17, 4:03 pm, Vijay Khandar  wrote:
> Can anyone explain following sentence-> True or False and explain
>
> "All instructions affect the flags"
>
> Vijay Khandar...

-- 
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] Plz Explain the working

2011-10-03 Thread ~*~VICKY~*~
@Shauib: cool soln. Thank you.

On Mon, Oct 3, 2011 at 6:14 PM, Shuaib  wrote:

> Chk is a macro that gets replaced with an if statement. The else part gets
> attached to the most recent if which is the one from the macro. And since
> the condition in macro fails, the else clause is executed.
>
> --
> Shuaib
> http://twitter.com/ShuaibKhan
> http://www.bytehood.com/
>
> On 03-Oct-2011, at 4:47 PM, "~*~VICKY~*~"  wrote:
>
> #include
> #define chk(cond) if(!(cond))\
> fprintf(stderr,"chk failed: %s,file %s, line %d \n", #cond,\
> __FILE__,__LINE__),abort()
> main()
> {
> int i = 0;
> if(i==0)
> chk(i < 100);
> else
> printf("hello");
> printf(" world");
> }
>
> output: hello world
>
> can anyone clearly explain how this works.
>
>
> --
> Cheers,
>
>   Vicky
>
>  --
> 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.
>



-- 
Cheers,

  Vicky

-- 
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] Doubly linked list with one pointer

2011-10-02 Thread ~*~VICKY~*~
ya thanks a lot rahul !

On Sun, Oct 2, 2011 at 11:39 PM, rahul sharma wrote:

> hope u were asking about dat...
>
>
> On Sun, Oct 2, 2011 at 11:36 PM, rahul sharma wrote:
>
>> http://www.geeksforgeeks.org/archives/12367
>>
>>
>> On Sun, Oct 2, 2011 at 11:34 PM, ~*~VICKY~*~ wrote:
>>
>>> @rahul : can u give any related links plz
>>>
>>>
>>> On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma 
>>> wrote:
>>>
>>>> xor linked list.
>>>>
>>>> On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ 
>>>> wrote:
>>>>
>>>>>
>>>>> Design a logic to implement doubly linked list with only one pointer
>>>>> --
>>>>> Cheers,
>>>>>
>>>>>   Vicky
>>>>>
>>>>>  --
>>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>>
>>>   Vicky
>>>
>>>  --
>>> 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.
>



-- 
Cheers,

  Vicky

-- 
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] Doubly linked list with one pointer

2011-10-02 Thread ~*~VICKY~*~
@rahul : can u give any related links plz

On Sun, Oct 2, 2011 at 11:33 PM, rahul sharma wrote:

> xor linked list.
>
> On Sun, Oct 2, 2011 at 11:32 PM, ~*~VICKY~*~ wrote:
>
>>
>> Design a logic to implement doubly linked list with only one pointer
>> --
>> Cheers,
>>
>>   Vicky
>>
>>  --
>> 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.
>



-- 
Cheers,

  Vicky

-- 
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] Doubly linked list with one pointer

2011-10-02 Thread ~*~VICKY~*~
Design a logic to implement doubly linked list with only one pointer
-- 
Cheers,

  Vicky

-- 
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] without using '-'

2011-09-26 Thread ~*~VICKY~*~
Tricky question with more tricky answers. thank you all.

On Mon, Sep 26, 2011 at 9:55 PM, Kunal Yadav  wrote:

> difference = x+ ~y +1
>
> On Mon, Sep 26, 2011 at 7:33 PM, ~*~VICKY~*~ wrote:
>
>> Find the difference of two numbers without using '-' operator !
>>
>> plz share ur solutions!
>>
>> --
>> Cheers,
>>
>>   Vicky
>>
>>  --
>> 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
> Kunal Yadav
> (http://sourcebit.in)
>
>
>  --
> 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.
>



-- 
Cheers,

  Vicky

-- 
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] without using '-'

2011-09-26 Thread ~*~VICKY~*~
Find the difference of two numbers without using '-' operator !

plz share ur solutions!

-- 
Cheers,

  Vicky

-- 
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] TREE question

2011-08-13 Thread vicky S
Given 2 trees .Find wether second tree is the subtree of the first tree .


here is my soln corect me if i m wrong:

bool find(struct node * tree,struct node *subtree)
{

  if(tree==NULL )
 return ;


if(tree->data==subtree->data   && find(tree->left,subtree->left) &&
find(tree->right,subtree->right)  &&   (subtree->left)!=NULL &&
subtree->right
!=NULL)
 {
 return true;
}
else
 return false

find(tree->left,subtree);
find(tree->right,subtree);
}

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

2011-08-13 Thread vicky S
Given a string which has repeating pattern .Find the repeating pattern and
the length of the pattern .

Example:
123123123123123
output :
123
lenth is 3

1122222211

output :
112211
lenght is 6

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

2011-08-13 Thread vicky S
Given a string which oly has 0's and 1's . Find the maximum largest
substring which have equal no of 0's and 1's and give the length of the
substring .
whether it can be solved in DP ?? or any other soln ?
for example :
given string : 001101000
output :0101

-- 
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] Global Scholar

2011-08-06 Thread vicky S
Any one know how the global scholar written round will be ? whether they
concentrate on OOPs language lik C++ Java or c aptitudes itself enough ? how
wil be the next techinical  rounds ?
Thanks in adcance :)

-- 
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] joining group

2011-07-30 Thread vicky suradkar
i am join this group

-- 
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] TIC TAC TOE

2011-07-28 Thread ~*~VICKY~*~
You can collect all winning combinations and store them separately and check
whether each of them have occured! The complexity will be
T(n) = O(no of possible winning combinations)

On Thu, Jul 28, 2011 at 7:16 PM, amit karmakar wrote:

> Will the given game configuration always be a completed game i.e no more
> moves can be done?
>
>
> On Thu, Jul 28, 2011 at 7:10 PM, radha krishnan <
> radhakrishnance...@gmail.com> wrote:
>
>> Excuse me MR.balaji :P
>> U got selected for Microsoft Redmond :P still preparing ? :P
>>
>> On Thu, Jul 28, 2011 at 6:01 AM, Balaji S 
>> wrote:
>> > Given a 3X3 matrix , with 1's 0's and -1's ( 1 is player one 0 is player
>> two
>> > -1 is none)
>> >
>> > how ll you find who is the winner / draw in a tic tac toe game in the
>> most
>> > effiecient manner...
>> >
>> > --
>> > With Regards,
>> > Balaji.S
>> >
>> > --
>> > 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.
>



-- 
Cheers,

  Vicky

-- 
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] C OUTPUT

2011-07-24 Thread ~*~VICKY~*~
Consider the binary representation of 257 which is 10001

which will be stored in little endain representation as least significant
eight bits + most significant eight bits as follows

0001 | 0001

now iptr on casting to char will point to least significant eight bits which
is 1, when u increment iptr it refers to most sig 8 bits which is also 1

hence the o/p will be : 1 1


hope it helps!

On Mon, Jul 25, 2011 at 11:41 AM, aditya kumar  wrote:

> main()
> {
> int i = 257;
> int *iPtr = &i;
> printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
> }
>
> can any one explain me the o/p ??
>
> --
> 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.
>



-- 
Cheers,

  Vicky

-- 
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] C aps sources plz

2011-07-24 Thread ~*~VICKY~*~
Hi all, as i find it hard to find a site that has a collection of non
obvious or fairly hard  c aps sites anywhere, i seek help here. plz post if
u find any source proving to be useful.


-- 
Cheers,

  Vicky

-- 
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] MS interview

2011-07-20 Thread ((** VICKY **))
Given a linked list with a n*n matrix elements write an algo to
compute product of two such linked list.
say n  = 3then

1 2 3
4 5 6
7 8 9

will be given as 1->2->3->4->5->6->7->8->9

now given two matrices , given a algo to perform  matrix
multiplication giving result in thrid linked list.

-- 
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] MS ques

2011-07-20 Thread ~*~VICKY~*~
@Deepthi: Thanks a lot :)

On Wed, Jul 20, 2011 at 11:33 AM, Deepthi Srinivasan wrote:

> @Vicky
> Piyush's algo is based on a little trick to determine divisibility by 3.
> Number of bits set in odd position - Number of bits set in even position 'll
> be divisible by 3
> For example, take 9. 1001. No. of bits set in odd position - number of bits
> set in even position is 0. Hence divisible by 3.
> For 21, 10101. Difference is 3.. SO just keep count of the number of bits
> set in odd position and even position as the stream
> progresses and ur done...
>
>
> On Tue, Jul 19, 2011 at 10:35 PM, SAMM  wrote:
>
>> find the difference between the set bits in the odd and even position,
>> if this diff is divisible by 3, then it is the multiple of 3..
>>
>> On 7/20/11, ~*~VICKY~*~  wrote:
>> > @Piyush Sinha:
>> >
>> > Can u plz state an example? I don get ur algo
>> >
>> > On Wed, Jul 20, 2011 at 12:52 AM, SAMM 
>> wrote:
>> >
>> >> The above method is good , I was going to suggest another algo it
>> >> takes the same complexity but lengthy so I am not posting my algo...
>> >>
>> >> On 7/19/11, Piyush Sinha  wrote:
>> >> > Divisibility of 3 of numbers in base 2 can be seen same as
>> >> > divisibility of numbers by 11 in base 10...
>> >> >
>> >> > maintain two variable even_sum & odd_sum, both initialized to 0
>> >> >
>> >> > when an odd location in the number is set increment odd_sum
>> >> > when an even location in the number is set increment even_sum
>> >> >
>> >> > if(abs(even_sum-odd_sum)%3==0) number is divisible by 3...
>> >> >
>> >> > Hence keep the track of even_sum and odd_sum as the bits are getting
>> >> > appended..
>> >> >
>> >> > Hope I am clear... :)
>> >> >
>> >> > On 7/19/11, sudhanshu pandey  wrote:
>> >> >> use automata theory. draw dfa for divisibility by 3..
>> >> >>
>> >> >> On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh
>> >> >> wrote:
>> >> >>
>> >> >>> Given an infinite stream of bits with bits being appended at the
>> >> >>> highest significant position. Give an algorithm to say whether the
>> >> >>> number formed by sequence of bits that had been processed till then
>> ,
>> >> >>> is divisible by 3 or not ?
>> >> >>>
>> >> >>>
>> >> >>> My sol:
>> >> >>>
>> >> >>> have a variable sum...find the sum of bitswhenever u add a
>> bit
>> >> >>> do sum+="bit value"  ... check whether sum%3==0.
>> >> >>> Is my solution ok?? anyother good solutions ??
>> >> >>>
>> >> >>> --
>> >> >>> 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.
>> >> >>>
>> >> >>>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> SUDHANSHU PANDEY
>> >> >>
>> >> >> --only fair thing in this world is a chance--
>> >> >>
>> >> >> --
>> >> >> 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.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > *Piyush Sinha*
>> >> > *IIIT, Allahabad*
>> >> > *+9

Re: [algogeeks] Re: Amazon ques

2011-07-20 Thread ~*~VICKY~*~
For quest 1 given as "Each number is present at least once except for 2
numbers." We can't apply the math formula unless its given as exactly once ?

On Wed, Jul 20, 2011 at 4:28 PM, saurabh singh  wrote:

> space o(n) toomine takes o(1) space
>
>
> On Wed, Jul 20, 2011 at 3:50 PM, JIƬΣN BAJIYA wrote:
>
>> simple one!! . all the missing nos which r not present b/w 1 to n will
>> be printed!! TC O(n)
>>
>> #include 
>>
>> #define size 1
>>
>> int main()
>> {
>> int i, j, n;
>>
>> scanf("%d", &n);
>>
>> int a[n + 1] ;
>> int b[n + 1] ;
>> a[0] = 0;
>> b[0] = 0;
>>
>> for (i = 1; i <= n ; i++){
>> scanf("%d", &a[i]);
>> b[i] = 0;
>> }
>>
>> for(j = 1; j <= n ; j++){
>> if (b[a[j]] == 0){
>> b[a[j]] = 1;
>> }
>> }
>> printf("missing no's are: \n");
>>
>>
>> for( i = 1; i <= n ; i++){
>> //  printf("%d ",b[i] );
>> if(b[i] == 0){
>> printf("%d  ", i);
>> }
>> }
>> return 0;
>>
>> }
>>
>> --
>> 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.
>>
>
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> 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 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.
>



-- 
Cheers,

  Vicky

-- 
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] Non-redundant permutations of the string

2011-07-20 Thread ~*~VICKY~*~
@SkRiPt KiDdIe

kindly explain the working of ur algo with the given example

On Wed, Jul 20, 2011 at 1:09 AM, SkRiPt KiDdIe wrote:

> #include
> #include
> using namespace std;
>
> void permute(string str,int x,string print)
> {
>
> int mask=0;
>
> if(!x){cout<
> for(int i=0;i {
> if(mask&(1<<(str[i]-'a')))continue;
> if(i && i+1 permute(str.substr(0,i)+str.substr(i+1,x-i),x-1,print+str[i]);
> else if(i)
> permute(str.substr(0,i),x-1,print+str[i]);
> else
> permute(str.substr(1,x-1),x-1,print+str[i]);
> mask=mask^(1<<(str[i]-'a'));
> }
> }
>
> int main()
> {
> string str,print="";
> cin>>str;
> permute(str,str.size(),print);
> return 0;
>
> }
>
> --
> 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.
>



-- 
Cheers,

  Vicky

-- 
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] MS ques

2011-07-19 Thread ~*~VICKY~*~
@Piyush Sinha:

Can u plz state an example? I don get ur algo

On Wed, Jul 20, 2011 at 12:52 AM, SAMM  wrote:

> The above method is good , I was going to suggest another algo it
> takes the same complexity but lengthy so I am not posting my algo...
>
> On 7/19/11, Piyush Sinha  wrote:
> > Divisibility of 3 of numbers in base 2 can be seen same as
> > divisibility of numbers by 11 in base 10...
> >
> > maintain two variable even_sum & odd_sum, both initialized to 0
> >
> > when an odd location in the number is set increment odd_sum
> > when an even location in the number is set increment even_sum
> >
> > if(abs(even_sum-odd_sum)%3==0) number is divisible by 3...
> >
> > Hence keep the track of even_sum and odd_sum as the bits are getting
> > appended..
> >
> > Hope I am clear... :)
> >
> > On 7/19/11, sudhanshu pandey  wrote:
> >> use automata theory. draw dfa for divisibility by 3..
> >>
> >> On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh
> >> wrote:
> >>
> >>> Given an infinite stream of bits with bits being appended at the
> >>> highest significant position. Give an algorithm to say whether the
> >>> number formed by sequence of bits that had been processed till then ,
> >>> is divisible by 3 or not ?
> >>>
> >>>
> >>> My sol:
> >>>
> >>> have a variable sum...find the sum of bitswhenever u add a bit
> >>> do sum+="bit value"  ... check whether sum%3==0.
> >>> Is my solution ok?? anyother good solutions ??
> >>>
> >>> --
> >>> 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.
> >>>
> >>>
> >>
> >>
> >> --
> >> SUDHANSHU PANDEY
> >>
> >> --only fair thing in this world is a chance--
> >>
> >> --
> >> 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.
> >>
> >>
> >
> >
> > --
> > *Piyush Sinha*
> > *IIIT, Allahabad*
> > *+91-7483122727*
> > * <https://www.facebook.com/profile.php?id=10655377926> "NEVER SAY
> > NEVER"
> > *
> >
> > --
> > 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.
> >
> >
>
>
> --
> Somnath Singh
>
> --
> 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.
>
>


-- 
Cheers,

  Vicky

-- 
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: is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?

2011-07-19 Thread ~*~VICKY~*~
Ya sorry abt that my algo is wrong!

On Tue, Jul 19, 2011 at 3:35 PM, Bhanu Kishore wrote:

> @Venkat. That algorithm doesnt work actually.Try for 9,8,1. At 1 , it
> becomes 0.
>
>  --
> 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.
>



-- 
Cheers,

  Vicky

-- 
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: is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?

2011-07-19 Thread ((** VICKY **))
doing xor of all elements in array[][] should work. you start from a[0]
[0] to a[0][n] then a[1][0] .. when the xor value bcomz 0 then the
corresponding value in arr[i][j] is the first repeated element in the
array. though this code will have two loops and seem as O(n2) it will
terminate once it finds the first repeated no. hope my algo works.
comments plz

On Jul 19, 2:14 am, Dumanshu  wrote:
> You have to use parallel computing to find the first repeating number
> in O(n) time if theres nothing special about the 2-D array
> Use n +1 processes, n processes to scan each row and 1 process to scan
> the rows last and next rows first element to check for repetition.
> Each process uses hash table to find the first non repeating number.
> When we have the results from all the processes, do O(n) scanning, and
> output the result for minimum row which wud be the first repetition.
>
> On Jul 18, 10:42 pm, snehi jain  wrote:
>
>
>
>
>
>
>
> > this question was asked in an interview.
>
> > Regards
> > Snehi

-- 
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 nice Prob

2010-07-01 Thread vicky
Actually i saw a forum of MS questions and same as i wrote was written
there. I too was confused but finally came to conclusion as u.
Anyways

On Jul 1, 5:51 pm, Gene  wrote:
> On Jul 1, 6:46 am, vicky  wrote:
>
> > It took me more time to understand this problem then solving after i
> > understood.
> > You guys too have a look @ it.::
> > Let f(k) = y where k is the y-th number in the increasing sequence of
> > non-negative
> > integers with the same number of ones in its binary representation as
> > y, e.g. f(0) = 1, f(1) => 1, f(2) = 2, f(3) = 1, f(4) = 3, f(5) = 2, f(6) = 
> > 3
> > and so on.
> > Given k >= 0, compute f(k).
>
> There must be a mistake in you problem statement or examples.  It only
> makes sense if you change it as follows:
>
> Let f(k) = y where k is the y-th number in the increasing sequence of
> non-negative integers with the same number of ones in its
> binary representation as k, <<-- change this from y to k.

-- 
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] A nice Prob

2010-07-01 Thread vicky
It took me more time to understand this problem then solving after i
understood.
You guys too have a look @ it.::
Let f(k) = y where k is the y-th number in the increasing sequence of
non-negative
integers with the same number of ones in its binary representation as
y, e.g. f(0) = 1, f(1) =
1, f(2) = 2, f(3) = 1, f(4) = 3, f(5) = 2, f(6) = 3 and so on. Given k
>= 0, compute f(k).

-- 
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: isbst

2010-07-01 Thread vicky
just do one thing print inorder. if sorted it is a BST

On Jun 19, 2:57 pm, divya  wrote:
> i have found the following code on net to check if the binarytreeis
> bst or not
> /*
> Returns true if a binarytreeis a binary searchtree.
> */
> int isBST(struct node* node) {
> if (node==NULL) return(true);
> // false if the min of the left is > than us
> if (node->left!=NULL && minValue(node->left) > node->data)
> return(false);
> // false if the max of the right is <= than us
> if (node->right!=NULL && maxValue(node->right) <= node->data)
> return(false);
> // false if, recursively, the left or right is not a BST
> if (!isBST(node->left) || !isBST(node->right))
> return(false);
> // passing all that, it's a BST
> return(true);
>
> }
>
> int minValue(struct node* node) {
> struct node* current = node;
> // loop down to find the leftmost leaf
> while (current->left != NULL) {
> current = current->left;}
>
> return(current->data);
>
> }
>
> and maxvalue also similarly returns right most vaslue oftree..
>
> now i have a doubt that here v r comparing the node->data with only
> the min node nd max node.. shd nt we compare the node data with its
> left node and right node only.
> as it can b a case that node value is greater than min but less than
> its left node.. nd here we r nt checking that...
>
> plzz correct me if i m wrong...
>
> and is there any other efficient method to find isbst?

-- 
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: non recursive tree traversals

2010-07-01 Thread vicky
I m adding my program too, with some 2-3 added features:




#include 
#include 
#include 
#include
#include
#include 
#include 
#include 
using namespace std;
 // BST-node layout
typedef struct Tree{
int data;
Tree *left;
Tree *right;
}treeObject;
// allocate memory to new node. notice pass by address of node
void AllocateMemory(treeObject **node){
*node=new treeObject;
 (*node)->left=(*node)->right=NULL;
}
// insert a new node
void Insert(treeObject *node,treeObject *root,int data){
if(root==NULL){
return;
}
node->data=data;
treeObject *prev=NULL;
treeObject *next=NULL;
next=prev=root;
   while(next!=NULL){
prev=next;
if(next->data<=data){
next=next->right;
}
else{
next=next->left;
}
}
if(prev->data<=data){
prev->right=node;
}
else{
prev->left=node;
}
}
//recursive inorder traversal
void RecInorder(treeObject *node){
if(node==NULL){
return;
}
RecInorder(node->left);
coutright);
}
//recursive postorder traversal
void RecPostorder(treeObject *node){
if(node==NULL){
return;
}
RecInorder(node->left);
RecInorder(node->right);
coutleft);
RecInorder(node->right);
}
//Iterative Inorder traversal
void IterInorder(treeObject *node){
stack S;
treeObject *temp=node;
while(temp!=NULL){
S.push(temp);
if(temp->left!=NULL){
temp=temp->left;
}
else {
if(temp->left==NULL){
if(temp->right==NULL){
coutright;
}
if(S.empty()){return;}
S.pop();
}
else{
coutright;
}
}
}
}
}
void BFT(treeObject *node){
queueQ;
Q.push(node);
while(!Q.empty()){
coutleft)Q.push(Q.front()->left);
if(Q.front()->right)Q.push(Q.front()->right);
Q.pop();
}
}

int main(){
treeObject *root;
int i=10;
AllocateMemory(&root);
root->data=0;
treeObject *node;
AllocateMemory(&node);
Insert(node,root,10);
treeObject *node1;
AllocateMemory(&node);
Insert(node,root,71);
treeObject *node2;
AllocateMemory(&node);
Insert(node,root,12);
treeObject *node3;
AllocateMemory(&node);
Insert(node,root,2);
treeObject *node4;
AllocateMemory(&node);
Insert(node,root,222);
treeObject *node5;
AllocateMemory(&node);
Insert(node,root,5);
treeObject *node6;
AllocateMemory(&node);
Insert(node,root,8);
treeObject *node7;
AllocateMemory(&node);
Insert(node,root,65);
treeObject *node8;
AllocateMemory(&node);
Insert(node,root,5);
treeObject *node9;
AllocateMemory(&node);
Insert(node,root,9);
treeObject *node10;
AllocateMemory(&node);
Insert(node,root,1);
cout<<"recursive Inorder traversal\n";
RecInorder(root);
cout< wrote:
> It might be right.  But it requires marks on the nodes, so it's not a
> fully general algorithm, and probably not what you want.  Here is the
> full algorithm that implements all the orders.  Take your pick.  It
> does turn out that if you don't need post order, you can simplify
> further.  In particular, you no longer need the 1/0 flag stored on the
> stack.  You only need a stack of pointers.
>
> void si(NODE *tree)
> {
>
>   for (;;) {
>     while (tree) {
>       printf("preorder %d\n",tree->val);
>       PUSH(tree, 0);
>      tree=tree->left;
>     }
>     for (;;) {
>       if (!sp) return; // return on stack empty
>       if (POP(tree) == 0) {
>         printf("inorder %d\n",tree->val);
>         PUSH(tree, 1);
>        tree=tree->right;
>         break;
>       }
>       printf("postorder %d\n",tree->val);
>     }
>   }
>
> }
>
> On Jun 19, 10:59 am, divya jain  wrote:
>
>
>
> > /*
> >    Assuming you have a stack setup with push() and pop() operations.
> >    Also assuming that all nodes are initially marked to 0.
> >    (This function will reset them back to zero when finished)
> > */
> > void postorder(Node *n) {
> >   push(n);
>
> >   while (stack.size > 0) {
> >     n = (Node*)pop();
>
> >     if (n->marked || (n->left == NULL && n->right == NULL))

[algogeeks] wat will be da algo for this DP problem ?

2009-12-30 Thread vicky
ques->Given a list of N coins, their values (V1, V2, ... , VN), and
the total sum S. Find the minimum number of coins the sum of which is
S (we can use as many coins of one type as we want), or report that
it's not possible to select coins in such a way that they sum up to
S.

ex:
S=11
coins: 1,3,5
ans:3->(5,5,1)

S=6
coins:1,3,5
ans:2,(3,3 or 1,5)

S=20
coins:3,6,8
ans:3,(6,6,8)

S=15
coins:3,7,10
ans: not possible


--

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] An interview question

2009-12-17 Thread vicky
given a graph G(V,E) and a source vertex, v. no. of vetices n, and
edges e. you have to find  all different paths from vertex v to some
vertex N, having exactly i(1http://groups.google.com/group/algogeeks?hl=en.




[algogeeks] A MS QUESTION

2009-12-15 Thread vicky
Given a file with a lot of words (10 million) find out the top 10%
most
frequently occuring words.

--

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] Difference between Dijkstra's algorithm and Bellman-Ford's algorithm?

2009-12-14 Thread vicky
What is the difference between Dijkstra's algorithm and Bellman-Ford's
algorithm?

--

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] 100!

2009-10-10 Thread vicky

find some of all the digits in number->100!

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



[algogeeks] Re: n balls and k different colors 1<=k<=n

2009-10-10 Thread vicky

i didn't get anything plz elaborate

On Oct 10, 10:44 am, Prunthaban Kanthakumar 
wrote:
> Sterling numbers of second kind.
>
>
>
> On Sat, Oct 10, 2009 at 10:41 AM, vicky  wrote:
>
> > example:
> > n=10,k=10
> > ans:1
> > n=30,k=7
> > ans:
> > 475020
> > On Oct 10, 9:51 am, vicky  wrote:
> > > u have to color n similar balls with k diff. colors , such that every
> > > color must be used atleast once find the no. of ways

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



[algogeeks] Re: n balls and k different colors 1<=k<=n

2009-10-09 Thread vicky

example:
n=10,k=10
ans:1
n=30,k=7
ans:
475020
On Oct 10, 9:51 am, vicky  wrote:
> u have to color n similar balls with k diff. colors , such that every
> color must be used atleast once find the no. of ways

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



[algogeeks] n balls and k different colors 1<=k<=n

2009-10-09 Thread vicky

u have to color n similar balls with k diff. colors , such that every
color must be used atleast once find the no. of ways

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



[algogeeks] Re: probabiltiy + DP

2009-09-23 Thread vicky

@ Minjie Zha ,
hey, how does these things clicks to u , as i thought it for 2 hrs.
and still couldn't find a completely correct sol..

On Sep 19, 2:04 pm, Minjie Zha  wrote:
> Oh yes, I made a mistake.
> Your are right.
>
> On Sep 18, 12:02 am, ashish gupta  wrote:
>
>
>
> > i think there might be some modification
>
> > On Thu, Sep 17, 2009 at 4:17 PM, Minjie Zha  wrote:
>
> > > Let PH(j,w) be the probability of getting w heads from 1...j coins,
> > > 0<=j<=k, 0<=w<=k.
> > > So we have:
> > > PH(0,0) = 1
>
> >  PH( j, w ) = 0  if w< 0
>
> > > PH(0,w) = 0 for w>0
> > > PH(j,0) = (1-P(1))(1-P(2))...(1-P(j))
>
> > > PH(j,w) = PH(j-1,w) + PH(j-1,w-1)PH(j)
>
> > and equation should be
> > PH(j, w)  = PH(j-1,w) (1-P(j)) + PH( j-1, w-1) PH(j)
>
> > pls correct if i am wrong...
>
> > --
> > ashish
>
> > > Any comments?
>
> > > On Sep 9, 5:50 pm, Nagendra Kumar  wrote:
> > > > @all:
> > > >           There are k baised coins with probabilty of coming head is
> > > > P(i)  i = 1 to k.  If all these coins are  tossed together. find the
> > > > probabilty of getting i heads ( i < = k).
> > > >    think in Dynamic Programming.
> > > > -Nagendra

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



[algogeeks] Re: Form of 3^n

2009-09-23 Thread vicky

yaa , that's right as then we are sure of having complexity O(n)

On Sep 23, 4:39 pm, Dufus  wrote:
> Vicky, Yup! you got it there.
> BTW you might like to do binary search again instead of sequential
> search when you hit the break condition.
> to indeed make it O(logn).
> Infact if M=3^n is given then this algo would be of complexity O(log
> log M)
>
> _dufus
>
> On Sep 23, 11:59 am, vicky  wrote:
>
>
>
> > ok i can tell one with complexity of O(log(n)) , u take a no. pow =
> > 3,temp=3;
> > then
> > while(1){
> > temp=pow;
> > pow*=pow;
> > if(pow>n){
> >     pow=pow/temp;
> >     break;
> >     }
> >   }
> > now do , pow =pow *3; untill pow>=n;
> > and check from here
> > am i clear?
> > On Sep 23, 2:40 am, Dave  wrote:
>
> > > He didn't ask for efficient ways, only other ways.
>
> > > On Sep 22, 2:36 pm, Ramaswamy R  wrote:
>
> > > > Can we evaluate the logarithm any more efficiently that repeated 
> > > > division by
> > > > 3?
>
> > > > On Tue, Sep 22, 2009 at 12:27 PM, Dave  wrote:
>
> > > > > You could compute the logarithm of the number to the base 3 and see if
> > > > > the result is an integer.
>
> > > > > Dave
>
> > > > > On Sep 21, 12:22 pm, Anshya Aggarwal 
> > > > > wrote:
> > > > > > how to find that whether the given number was of the form 3^n. ( 
> > > > > > i.e. 3
> > > > > to
> > > > > > the power n).
> > > > > > one way is to recursively divide the number by 3 and check the 
> > > > > > remainder.
> > > > > > Is there any other way using bit manipulation or anything else??
>
> > > > > > --
> > > > > > Anshya Aggarwal
>
> > > > --
> > > > Yesterday is History.
> > > > Tomorrow is a Mystery.
> > > > Today is a Gift! That is why it is called the Present :).
>
> > > >http://sites.google.com/site/ramaswamyr-Hidequotedtext -
>
> > > > - Show quoted text -

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



[algogeeks] Re: Form of 3^n

2009-09-23 Thread vicky

ok i can tell one with complexity of O(log(n)) , u take a no. pow =
3,temp=3;
then
while(1){
temp=pow;
pow*=pow;
if(pow>n){
pow=pow/temp;
break;
}
  }
now do , pow =pow *3; untill pow>=n;
and check from here
am i clear?
On Sep 23, 2:40 am, Dave  wrote:
> He didn't ask for efficient ways, only other ways.
>
> On Sep 22, 2:36 pm, Ramaswamy R  wrote:
>
>
>
> > Can we evaluate the logarithm any more efficiently that repeated division by
> > 3?
>
> > On Tue, Sep 22, 2009 at 12:27 PM, Dave  wrote:
>
> > > You could compute the logarithm of the number to the base 3 and see if
> > > the result is an integer.
>
> > > Dave
>
> > > On Sep 21, 12:22 pm, Anshya Aggarwal 
> > > wrote:
> > > > how to find that whether the given number was of the form 3^n. ( i.e. 3
> > > to
> > > > the power n).
> > > > one way is to recursively divide the number by 3 and check the 
> > > > remainder.
> > > > Is there any other way using bit manipulation or anything else??
>
> > > > --
> > > > Anshya Aggarwal
>
> > --
> > Yesterday is History.
> > Tomorrow is a Mystery.
> > Today is a Gift! That is why it is called the Present :).
>
> >http://sites.google.com/site/ramaswamyr-Hide quoted text -
>
> > - Show quoted text -

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