Algo for gcd(u,v) :
gcd(0,v)=v and gcd(u,0)=u;
gcd(u,v)=2*(gcd(u/2,v/2)) if u and v are multiples of 2
gcd(u,v)=gcd(u/2 ,v) if u is a multiple of 2 and v is not
gcd(u,v)=gcd(u,v/2) if v is a multiple of 2 and u is not
gcd(u,v)= gcd((u-v)/2,v) if u and v are not multiples of 2 and u>=v
gcd(u,v)=gcd((v-u)/2,u) if u and v are not multiples of 2 and v>u

repeat above steps .. till found..
one thing more gcd(0,0) is not defined but can be assumed to be 0

On Fri, Jul 22, 2011 at 8:29 PM, shady <sinv...@gmail.com> wrote:

> what was it ? job interview questions or intern ?
>
> gcd can always be found in O(log(larger number)) , sorry, couldnt
> understand the complexity in that ?
>
>
> On Fri, Jul 22, 2011 at 8:22 PM, siva viknesh <sivavikne...@gmail.com>wrote:
>
>> @ankur.......... as u said i m posting today :) :)
>>
>> ........10 questions ....c output, one compiler based(CFG) ,one OS
>> based (when reading internally it was just a simple percentage
>> calculation question)..
>>
>> +3 for correct ans..
>> -2 for wrong ans...Damn it...... i dint notice d negative marking and
>> attended all :(
>>
>> ...questions were not so tough (neither so easy :P) and all , u just
>> need to think aloud
>>
>> 10 marks :
>>
>> 1. Find gcd of 2 numbers U & V in O(log UV)^2
>>
>> 2.   Test cases for finger print recognition say in a laptop to login
>>
>> 3. Design question......for billing , u have barcode, barcode number,
>> item price, taxes, discounts for items (some criteria were given and u
>> have to  design an algo for calculating discount) and then finally
>> compute Net price....what DS u ll use....how ll u improve this
>> design...State advantages and disadvantages.....
>>
>> ....u have to think aloud and innovative ..thats it :)
>>
>> On Jul 18, 8:46 pm, Ankur Garg <ankurga...@gmail.com> wrote:
>> > post on 22nd itself bro ;) ..there is a written  test on 23rd
>> >
>> > On Mon, Jul 18, 2011 at 8:45 PM, siva viknesh <sivavikne...@gmail.com
>> >wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > @all..........thanks a lot....sure ll post the questions after 22nd :)
>> >
>> > > On Jul 18, 8:13 pm, sourabh jakhar <sourabhjak...@gmail.com> wrote:
>> > > > study basic well they give a lot of emphasis on them
>> >
>> > > > On Mon, Jul 18, 2011 at 8:41 PM, SkRiPt KiDdIe <
>> anuragmsi...@gmail.com
>> > > >wrote:
>> >
>> > > > > After 22nd plz post ur questions ... !!
>> > > > > It wud be of great HelP.
>> >
>> > > > > --
>> > > > > You received this message because you are subscribed to the Google
>> > > Groups
>> > > > > "Algorithm Geeks" group.
>> > > > > To post to this group, send email to algogeeks@googlegroups.com.
>> > > > > To unsubscribe from this group, send email to
>> > > > > algogeeks+unsubscr...@googlegroups.com.
>> > > > > For more options, visit this group at
>> > > > >http://groups.google.com/group/algogeeks?hl=en.
>> >
>> > > > --
>> > > > SOURABH JAKHAR,(CSE)(Final year)
>> > > > ROOM NO 167 ,
>> > > > TILAK,HOSTEL
>> > > > 'MNNIT ALLAHABAD
>> >
>> > > > The Law of Win says, "Let's not do it your way or my way; let's do
>> it the
>> > > > best way."
>> >
>> > > --
>> > > 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.

Reply via email to