[algogeeks] Re: [Google question]

2012-08-01 Thread Don
What is N? This is a fixed-size problem so by definition, every
solution will be constant time.
Don

On Aug 1, 2:48 am, vikas rai  wrote:
> There is a set of 9 students and 3 schools Every school can be alloted
> atmax 3 students .Every school and student has its coordinates .Now we have
> to allot student in such a way that the sum of distance from all the
> student to the school should be minimum.
> We have to solve this in less than O(n^3) .

-- 
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] Dominating Points

2012-08-01 Thread Sambhavna Singh
yes :(

-- 
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] Dominating Points

2012-08-01 Thread atul anand
i can think of O(n^2) approach .. i guess you are expecting with less time
complexity

On Wed, Aug 1, 2012 at 9:49 AM, Sambhavna Singh wrote:

> If we are given a number of points on the XY-plane,
> [(x0,y0),(x1,y1),(x2,y2),...].
>
> A point (xi,yi) is dominant to another point (xj,yj) iff xi>xj and yi>yj.
>
> Calculate all pairs of points such that one dominates the other.
>
> --
> 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.



Re: [algogeeks] [Google question]

2012-08-01 Thread atul anand
seems like Hungarian algorithm will work .

On Wed, Aug 1, 2012 at 12:18 PM, vikas rai  wrote:

> There is a set of 9 students and 3 schools Every school can be alloted
> atmax 3 students .Every school and student has its coordinates .Now we have
> to allot student in such a way that the sum of distance from all the
> student to the school should be minimum.
> We have to solve this in less than O(n^3) .
>
>  --
> 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.



Re: [algogeeks] Removing space inplace

2012-08-01 Thread atul anand
j=0;
for i to len
   if(str[i] != '   ' )
   {
 str[j]=str[i];
  j++;
   }
end
str[j]='\0';

On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh wrote:

> Please have a look at this :
> http://www.careercup.com/question?id=14433699&utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+Careercup+%28CareerCup%29
>
> What does inplace shifting imply here? Cant i keep 2 pointers and
> overwrite a non space character onto a space character and advance both
> pointers till one again hits a space character and other a non-space
> character? Does that violate the condition given in the question?
>
>  --
> 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.



Re: [algogeeks] Removing space inplace

2012-08-01 Thread Sambhavna Singh
Ok thank you its much clear now :)

On Wed, Aug 1, 2012 at 1:40 PM, Daksh Talwar  wrote:

> By not allowing shifting , I guess they mean that you cannot shorten the
> overall length of the string .
> Eg . "ab  c"
> the output should not be obtained by shifting c to the 3rd postion in the
> array.
>
> On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh 
> wrote:
>
>> Please have a look at this :
>> http://www.careercup.com/question?id=14433699&utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+Careercup+%28CareerCup%29
>>
>> What does inplace shifting imply here? Cant i keep 2 pointers and
>> overwrite a non space character onto a space character and advance both
>> pointers till one again hits a space character and other a non-space
>> character? Does that violate the condition given in the question?
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> - - - - - - - - - - - -
> With Regards
> Daksh Talwar
>
> --
> 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.



Re: [algogeeks] Microsoft online questions

2012-08-01 Thread Navin Kumar
@Daksh: you are right :)

On Tue, Jul 31, 2012 at 11:30 PM, Daksh Talwar wrote:

> @Navin  : Thanks a lot .
> Also , I had this doubt , that taking the middle of the array as the root
> is just a convention right ?
> The tree we get is just one of the n(catalan number) trees we can get
> using the DLL/array given ..?
>
>
> On Tue, Jul 31, 2012 at 10:57 PM, manish untwal 
> wrote:
>
>> hey friends,
>> just wanted to ask like what they ask in quants and DI
>>
>>
>> On Tue, Jul 31, 2012 at 10:45 PM, Navin Kumar 
>> wrote:
>>
>>> @Daksh: total number of BST possible with n nodes will be : catalan
>>> number
>>>
>>> we can build balanced BST by each time selecting middle element as a
>>> root node and its left pointer will point to left linked list and right
>>> pointer will point to right linked list. Do it recursively for left list
>>> and right list.
>>>
>>> struct node *buildBST(struct node *list)
>>> {
>>>if(!list) return NULL;
>>>
>>>struct node *middle = getMiddle(list);
>>>middle->previous->next = NULL;
>>>middle->previous = buildBST(list);
>>>middle->next = buildBST(middle->next);
>>>return middle;
>>>
>>> }
>>>
>>> On Tue, Jul 31, 2012 at 8:35 PM, Daksh Talwar wrote:
>>>
 Anyone with a logic/algo/code for the " 3. convert sorted doubly
 linked list to bst using same nodes as in DLL. ".
 Would it be recursive ?

 On Tue, Jul 31, 2012 at 12:30 AM, Purani Sekar wrote:

> Analytical questions were from logical reasoning, syllogism, piechart,
> etc.
> Technical questions were like - they'll give a flow chart
> (eg:http://en.wikipedia.org/wiki/File:FlowchartExample.png) or C
> program and ask to trace the output. no data structures and all.
>
> On Sun, Jul 29, 2012 at 10:16 PM, Tanuj Makkar
>  wrote:
> > hi can u please elaborate on  analytical questions.like if they
> were
> > from logical reasoning,verbal(syllogism)
> > and in technical...were questions based on output of c programs...or
> there
> > were data structures nd other topics
> > plz help...it will be a great help ...
> > .
> > Thanx
> >
> > On Sun, Jul 29, 2012 at 9:58 PM, Purani Sekar 
> wrote:
> >>
> >> Hi,
> >> They conducted 2 online rounds.
> >>
> >> First round was of 1 hour duration. It tests your speed and
> analytical
> >> skills. The mark split was as given below:
> >> 30 analytical questions - data interpretation type
> >> 20 technical questiions - flow chart and  basic c
> >>
> >> Second round was online coding round. But compiler will not be
> >> provided. It will be like typing a code in notepad.
> >>
> >>
> >> On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
> >>  wrote:
> >> > Hi,
> >> >
> >> > Can anybody help by sharing MS online test pattern and questions ?
> >> > I have heard they have also included aptitude questions this
> time, is
> >> > that
> >> > right?
> >> >
> >> > Thanks
> >> > --
> >> > Sanchit Mittal
> >> > Fourth Year Undergraduate
> >> > Computer Engineering
> >> > Delhi College of Engineering
> >> > ph- +919582414494
> >> >
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "Algorithm Geeks" group.
> >> > To post to this group, send email to algogeeks@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > algogeeks+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/algogeeks?hl=en.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> 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] Removing space inplace

2012-08-01 Thread Daksh Talwar
By not allowing shifting , I guess they mean that you cannot shorten the
overall length of the string .
Eg . "ab  c"
the output should not be obtained by shifting c to the 3rd postion in the
array.

On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh wrote:

> Please have a look at this :
> http://www.careercup.com/question?id=14433699&utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+Careercup+%28CareerCup%29
>
> What does inplace shifting imply here? Cant i keep 2 pointers and
> overwrite a non space character onto a space character and advance both
> pointers till one again hits a space character and other a non-space
> character? Does that violate the condition given in the question?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
- - - - - - - - - - - -
With Regards
Daksh Talwar

-- 
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] Removing space inplace

2012-08-01 Thread dheeraj chawla
@sambhavna ...according to me u r violating the condition...bcoz using
pointer u r trying to do shifting(moving) character values with
spaces.so acc. to question is not correct..

On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh wrote:

> Please have a look at this :
> http://www.careercup.com/question?id=14433699&utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+Careercup+%28CareerCup%29
>
> What does inplace shifting imply here? Cant i keep 2 pointers and
> overwrite a non space character onto a space character and advance both
> pointers till one again hits a space character and other a non-space
> character? Does that violate the condition given in the question?
>
>  --
> 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] [Google question]

2012-08-01 Thread vikas rai
There is a set of 9 students and 3 schools Every school can be alloted
atmax 3 students .Every school and student has its coordinates .Now we have
to allot student in such a way that the sum of distance from all the
student to the school should be minimum.
We have to solve this in less than O(n^3) .

-- 
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] Microsoft online questions

2012-08-01 Thread Daksh Talwar
@Navin  : Thanks a lot .
Also , I had this doubt , that taking the middle of the array as the root
is just a convention right ?
The tree we get is just one of the n(catalan number) trees we can get using
the DLL/array given ..?

On Tue, Jul 31, 2012 at 10:57 PM, manish untwal wrote:

> hey friends,
> just wanted to ask like what they ask in quants and DI
>
>
> On Tue, Jul 31, 2012 at 10:45 PM, Navin Kumar wrote:
>
>> @Daksh: total number of BST possible with n nodes will be : catalan number
>>
>> we can build balanced BST by each time selecting middle element as a root
>> node and its left pointer will point to left linked list and right pointer
>> will point to right linked list. Do it recursively for left list and right
>> list.
>>
>> struct node *buildBST(struct node *list)
>> {
>>if(!list) return NULL;
>>
>>struct node *middle = getMiddle(list);
>>middle->previous->next = NULL;
>>middle->previous = buildBST(list);
>>middle->next = buildBST(middle->next);
>>return middle;
>>
>> }
>>
>> On Tue, Jul 31, 2012 at 8:35 PM, Daksh Talwar wrote:
>>
>>> Anyone with a logic/algo/code for the " 3. convert sorted doubly linked
>>> list to bst using same nodes as in DLL. ".
>>> Would it be recursive ?
>>>
>>> On Tue, Jul 31, 2012 at 12:30 AM, Purani Sekar wrote:
>>>
 Analytical questions were from logical reasoning, syllogism, piechart,
 etc.
 Technical questions were like - they'll give a flow chart
 (eg:http://en.wikipedia.org/wiki/File:FlowchartExample.png) or C
 program and ask to trace the output. no data structures and all.

 On Sun, Jul 29, 2012 at 10:16 PM, Tanuj Makkar
  wrote:
 > hi can u please elaborate on  analytical questions.like if they
 were
 > from logical reasoning,verbal(syllogism)
 > and in technical...were questions based on output of c programs...or
 there
 > were data structures nd other topics
 > plz help...it will be a great help ...
 > .
 > Thanx
 >
 > On Sun, Jul 29, 2012 at 9:58 PM, Purani Sekar 
 wrote:
 >>
 >> Hi,
 >> They conducted 2 online rounds.
 >>
 >> First round was of 1 hour duration. It tests your speed and
 analytical
 >> skills. The mark split was as given below:
 >> 30 analytical questions - data interpretation type
 >> 20 technical questiions - flow chart and  basic c
 >>
 >> Second round was online coding round. But compiler will not be
 >> provided. It will be like typing a code in notepad.
 >>
 >>
 >> On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
 >>  wrote:
 >> > Hi,
 >> >
 >> > Can anybody help by sharing MS online test pattern and questions ?
 >> > I have heard they have also included aptitude questions this time,
 is
 >> > that
 >> > right?
 >> >
 >> > Thanks
 >> > --
 >> > Sanchit Mittal
 >> > Fourth Year Undergraduate
 >> > Computer Engineering
 >> > Delhi College of Engineering
 >> > ph- +919582414494
 >> >
 >> >
 >> > --
 >> > You received this message because you are subscribed to the Google
 >> > Groups
 >> > "Algorithm Geeks" group.
 >> > To post to this group, send email to algogeeks@googlegroups.com.
 >> > To unsubscribe from this group, send email to
 >> > algogeeks+unsubscr...@googlegroups.com.
 >> > For more options, visit this group at
 >> > http://groups.google.com/group/algogeeks?hl=en.
 >>
 >> --
 >> You received this message because you are subscribed to the Google
 Groups
 >> "Algorithm Geeks" group.
 >> To post to this group, send email to algogeeks@googlegroups.com.
 >> To unsubscribe from this group, send email to
 >> algogeeks+unsubscr...@googlegroups.com.
 >> For more options, visit this group at
 >> http://groups.google.com/group/algogeeks?hl=en.
 >>
 >
 > --
 > You received this message because you are subscribed to the Google
 Groups
 > "Algorithm Geeks" group.
 > To post to this group, send email to algogeeks@googlegroups.com.
 > To unsubscribe from this group, send email to
 > algogeeks+unsubscr...@googlegroups.com.
 > For more options, visit this group at
 > http://groups.google.com/group/algogeeks?hl=en.

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


>>>
>>>
>>> --
>>> - - - - - - - - - - - -
>>> With Regards
>>> Daksh Talwar
>>>
>>> --
>>> 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 unsub

Re: [algogeeks] Re: coin problem

2012-08-01 Thread Hariraman R
 @vipin kumar,

The no 7 and x are just assumptions it may be of any
combinations... just try it in real time then you will have a clear
understanding.

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