Re: [algogeeks] [brain teaser ] Statement Riddle

2011-06-27 Thread sharad kumar
i have added anton nomiste as the new moderator...

On Mon, Jun 27, 2011 at 5:36 PM, sharad kumar wrote:

> banned!!!
>
> On Mon, Jun 27, 2011 at 5:32 PM, shady  wrote:
>
>> if moderators are alive, can they ban him ?
>>
>>
>> On Mon, Jun 27, 2011 at 12:48 PM, Lavesh Rawat wrote:
>>
>>>  *Statement Riddle  - 27 june
>>> * * *
>>> *
>>> *
>>> **
>>> *'Ferari driver' easily beats the 'force indain driver' in a two care
>>> race.How did Indian newspapers *
>>> *truthfully report so to look as 'force indain drive' had outdone the
>>> 'ferari driver'
>>> Think ??
>>> *
>>> *Update Your Answers at* : Click 
>>> Here<http://dailybrainteaser.blogspot.com/2011/06/statement-riddle.html?lavesh=lavesh>
>>>
>>> *Solution:*
>>> Will be updated after 1 day
>>>
>>>
>>>
>>>
>>> --
>>>
>>> "Never explain yourself. Your friends don’t need it
>>> and your enemies won’t believe it" .
>>>
>>> --
>>> 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.
>>>
>>
>>
>
>
> --
> yezhu malai vaasa venkataramana Govinda Govinda
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to 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] New moderators....

2011-06-15 Thread sharad kumar
hi guys,
Regarding the issue of new moderators I have decided to make
1)wladimirufc
2)nishanth
3)siva viknesh

as the new moderators..They will assist me to maintain the forum better.

I hope they discharge their responsibility in maintaining the dignity of the
forum...

@all: Please assist them in running the forum smoothly.

Thanks and enjoy the coding experience
-- 
God created man .Man created problems and God sent mother to help man

-- 
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] Fwd: Supermodels without Makeup (11 images)

2011-06-12 Thread sharad kumar
banned

On Sun, Jun 12, 2011 at 9:59 PM, Geo News <22au...@gmail.com> wrote:

>
> Supermodels without Makeup (11 images )
>
> No matter how gorgeous supermodels look on magazine covers, they can’t
> always be stunning in real life. Here is a small selection of famous models
> without makeup.
>
> Check out 9 more such supermodels after the jump.
>
> 
>
> Check out 10 more images, Click on the link below:-
>   http://tinyurl.com/studnt
>
>
>
>   **
>
>   *
> *
>
>
>
>  __._,_.___
>   Reply to 
> sender|
>  Reply
> to 
> group|
>  Reply
> via web 
> post|
>  Start
> a New 
> Topic
> Messages in this 
> topic(
> 1)
>  Recent Activity:
>
>- New 
> Members
>234
>
>  Visit Your 
> Group
>  [image: Yahoo! 
> Groups]
> Switch to: 
> Text-Only,
> Daily Digest•
> Unsubscribe  • Terms
> of Use 
>.
>
> __,_._,___
>
>
>
> --
> If you would like to get daily pictures
> We've started a Google Group to allow our visitors to get daily funny and
> Crazy Pictures , You can join this group for free , go to...
> *http://groups.google.com/group/WomenForum/subscribe*
>
>  --
> 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.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to 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: FOR ALL INDIANS PLZ READ IT

2011-06-12 Thread sharad kumar
please nominate atleast 5 more pplwithout self nomination[?]

On Sun, Jun 12, 2011 at 7:27 PM, ross  wrote:

> +1
>
> On Jun 12, 3:38 pm, Arpit Sood  wrote:
> > @present moderators + admin
> > atleast make those people as group moderators along with you who are
> > active.
> >
> > On Sun, Jun 12, 2011 at 3:21 PM, Akshata Sharma
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > finally!!! finally!! we have found the group admin! I agree with
> gaurav,
> > > please care to ban people like panzer and other spammers in future.
> >
> > > On Sun, Jun 12, 2011 at 10:31 AM, Gaurav Aggarwal <
> 0007gau...@gmail.com>wrote:
> >
> > >> so mr group manager, is this not your responsibility to filter the
> group
> > >> messages and remove people like sohail panezar who continuously spam
> the
> > >> group??
> >
> > >> On Sun, Jun 12, 2011 at 10:15 AM, sharad kumar <
> aryansmit3...@gmail.com>wrote:
> >
> > >>> please guys maintain the dignity of the forum...btw I'm the group
> > >>> manager.
> >
> > >>> On Sun, Jun 12, 2011 at 9:17 AM, Priyanshu  >wrote:
> >
> > >>>> hey harshal, i think u r pretty good in assuming things up.Never did
> i
> > >>>> told all muslims are terrorist nor did i told all pakistanis are
> terrorist.
> > >>>> So STFU.
> >
> > >>>> On Sat, Jun 11, 2011 at 8:21 PM, Harshal  wrote:
> >
> > >>>>> hey Priyanshu, no offence but that's too much dude!! Not all of
> them
> > >>>>> are terrorists and many muslims live in our country also! Those who
> want to
> > >>>>> give a call, do it, those who don't want, its their choice! But
> don't spoil
> > >>>>> the group by commenting irrelevant.
> > >>>>> And regarding the admin of the group, its Sridhar Ratna,
> > >>>>> sridharinfin...@gmail.com. He's no longer active I think.
> >
> > >>>>> On Sun, Jun 12, 2011 at 2:17 AM, Priyanshu <
> priyanshuro...@gmail.com>wrote:
> >
> > >>>>>> By this time one would have known that u are from pakistan
> asshole. At
> > >>>>>> least our country has a chance and hope to recover from this, but
> ur country
> > >>>>>> will rot in hell u son of a terrorist.
> >
> > >>>>>> PG
> >
> > >>>>>> On Fri, Jun 10, 2011 at 8:59 AM, Umer Farooq  >wrote:
> >
> > >>>>>>> Where is the admin of this group? These guys are discussing
> something
> > >>>>>>> completely irrelevant to Algorithms. Could anyone please take a
> notice of
> > >>>>>>> this in order to maintain the dignity of this group and filter
> the spam?
> >
> > >>>>>>> On Fri, Jun 10, 2011 at 8:30 PM, coder dumca <
> coder.du...@gmail.com>wrote:
> >
> > >>>>>>>> so what ? supporting anna hazare is not a bad idea.
> >
> > >>>>>>>> On Thu, Jun 9, 2011 at 12:54 PM, Naveen Kumar <
> > >>>>>>>> naveenkumarve...@gmail.com> wrote:
> >
> > >>>>>>>>> There is no such condition put up by the govt.
> > >>>>>>>>> If you give a missed call you are showing your support to Anna
> > >>>>>>>>> Hazare
> > >>>>>>>>> Please read
> > >>>>>>>>>
> http://theindiapost.com/delhi/support-hazare-give-call-02261550789/
> >
> > >>>>>>>>> On Thu, Jun 9, 2011 at 12:15 PM, Abdul Rahman Shariff <
> > >>>>>>>>> ears7...@gmail.com> wrote:
> >
> > >>>>>>>>>> did u try it ??
> > >>>>>>>>>> nd did u get the msg??
> >
> > >>>>>>>>>> On Thu, Jun 9, 2011 at 1:06 AM, kartik sachan <
> > >>>>>>>>>> kartik.sac...@gmail.com> wrote:
> >
> > >>>>>>>>>>> Frnz govt of india has put a condition dat lokpal bill will b
> > >>>>>>>>>>> implemented if 25 crore ppl spport it. plz give a miss
> kol(free) to
> > >>>>>>>>>>> 0226

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread sharad kumar
please guys maintain the dignity of the forum...btw I'm the group
manager.

On Sun, Jun 12, 2011 at 9:17 AM, Priyanshu  wrote:

> hey harshal, i think u r pretty good in assuming things up.Never did i told
> all muslims are terrorist nor did i told all pakistanis are terrorist. So
> STFU.
>
>
> On Sat, Jun 11, 2011 at 8:21 PM, Harshal  wrote:
>
>> hey Priyanshu, no offence but that's too much dude!! Not all of them are
>> terrorists and many muslims live in our country also! Those who want to give
>> a call, do it, those who don't want, its their choice! But don't spoil the
>> group by commenting irrelevant.
>> And regarding the admin of the group, its Sridhar Ratna,
>> sridharinfin...@gmail.com. He's no longer active I think.
>>
>> On Sun, Jun 12, 2011 at 2:17 AM, Priyanshu wrote:
>>
>>> By this time one would have known that u are from pakistan asshole. At
>>> least our country has a chance and hope to recover from this, but ur country
>>> will rot in hell u son of a terrorist.
>>>
>>> PG
>>>
>>>
>>>
>>> On Fri, Jun 10, 2011 at 8:59 AM, Umer Farooq wrote:
>>>
 Where is the admin of this group? These guys are discussing something
 completely irrelevant to Algorithms. Could anyone please take a notice of
 this in order to maintain the dignity of this group and filter the spam?

 On Fri, Jun 10, 2011 at 8:30 PM, coder dumca wrote:

> so what ? supporting anna hazare is not a bad idea.
>
>
> On Thu, Jun 9, 2011 at 12:54 PM, Naveen Kumar <
> naveenkumarve...@gmail.com> wrote:
>
>> There is no such condition put up by the govt.
>> If you give a missed call you are showing your support to Anna Hazare
>> Please read
>> http://theindiapost.com/delhi/support-hazare-give-call-02261550789/
>>
>>
>> On Thu, Jun 9, 2011 at 12:15 PM, Abdul Rahman Shariff <
>> ears7...@gmail.com> wrote:
>>
>>> did u try it ??
>>> nd did u get the msg??
>>>
>>> On Thu, Jun 9, 2011 at 1:06 AM, kartik sachan <
>>> kartik.sac...@gmail.com> wrote:
>>>
 Frnz govt of india has put a condition dat lokpal bill will b
 implemented if 25 crore ppl spport it. plz give a miss kol(free) to
 02261550789 .kol ends itself n u ll get a msg rply. Plz support against
 corruption...

 --

 *WITH REGARDS,*
 *
 *
 *KARTIK SACHAN*

 *B.TECH 2ND YEAR*
 *COMPUTER SCIENCE AND ENGINEERING*
 *NIT 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.

>>>
>>>
>>>
>>> --
>>>
>>> Ehab Abdul Rahman Shariff
>>>
>>> --
>>> 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
>> Naveen Kumar
>>
>>  --
>> 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.
>



 --
 Umer

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

Re: [algogeeks] ADULT SEX PHOTOS

2011-04-15 Thread sharad kumar
BANNED!

On Fri, Apr 15, 2011 at 12:51 AM, siddharth srivastava
wrote:

> Unexpected but most of us have quoted the spam in our replies :-)
>
> Well, I guess the moderator is reading and would take an action soon
>
> --
> Regards
> Siddharth Srivastava
>
>
>
> --
> 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.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to 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] Puzzle

2011-01-26 Thread sharad kumar
11-(9/9)

On Wed, Jan 26, 2011 at 7:42 PM, may.I.answer wrote:

> You have four numbers 1 , 1 , 9 ,9 .
> Now  using these four and operator + , - , * ,/ and parentheses(if
> required) your have to get 10.
>
> --
> 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.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to 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] celebrity twitters

2010-12-18 Thread sharad kumar
consider it as a directed graph and sink is the celebrity.do dfs to find
sink...

On Sat, Dec 18, 2010 at 11:30 PM, snehal jain  wrote:

> In a n twitter set, a celebrity is defined as someone who is followed
> by everyone, but who follows no one. You need to identify the
> celebrities by asking to twitters the question: "do you know person
> x?" The answer will be yes/no. Find the celebrity by asking only O(n)
> questions.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: N companies merge

2010-12-03 Thread sharad kumar
 merge N/2 +1 times...

On Sat, Dec 4, 2010 at 7:48 AM, Gene  wrote:

> This isn't quite right because you don't have to merge all the initial
> companies pairwise. I.e. you skip the case where A and B merge and
> then the result is merged with C.
>
> Rather, the answer is the number of binary trees with N leaves. (This
> does assume that all mergers involve only 2 companies.)  I'll let you
> look up how to compute these numbers.
>
> On Dec 3, 12:09 pm, Harshal  wrote:
> > Nc2 * N-1c2 * N-2c2 * . * 2c2.
> >
> > where Nc2 means the number of combinations that can be made out of N
> numbers
> > taken 2 at a time. After merging any 2 companies, you will have N-1
> > companies left, and so on. If I interpreted the question correct, this is
> my
> > solution. Any more ideas?
> >
> > harsh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: please explain the output

2010-11-07 Thread sharad kumar
basically it depend upon the way the parameters arre called ...it varies
from one compiler to other

On Sat, Nov 6, 2010 at 9:50 PM, Shalini Sah  wrote:

> firstly evaluate all prefix forms..++a will become 6..then a++ will remain
> 6..a=7 because postfix form of a will make it so..hence the result
> 7+6+6=19..
>
>
> On Sat, Nov 6, 2010 at 9:39 PM, Dave  wrote:
>
>> @Bipul21: This is nonstandard, so the results are compiler-dependent.
>> It is improper to have more than one assignment to the same variable
>> between synchronization points.
>>
>> Dave
>>
>> On Nov 6, 10:42 am, bipul21  wrote:
>> > #include
>> > int main()
>> > {
>> >int a=5;
>> > a=a+(a++)+(++a);
>> > printf("%d",a);
>> > return 0;}
>> >
>> > answer is 19 but how??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] zero sum subarray

2010-11-06 Thread sharad kumar
keep storing the elements in hash..
now keep adding the elements of array is the sum is -ve calculate -(-sum)
ans search in hash.
lllrly do it for +ve...
O(n) in space and O(n) time i guess

On Sat, Nov 6, 2010 at 7:21 PM, MAC  wrote:

> an array contain +ve and -ve element, find subarray whose sum is 0
>
> --
> thanks
> --mac
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] DP

2010-10-07 Thread sharad kumar
is he allowed to pick only from end??



On Fri, Oct 8, 2010 at 5:44 AM, Anand  wrote:

> Given a row of notes (with specified values), two players play a game. At
> each turn, any player can pick a note from any of the two ends. How will the
> first player maximize his score? Both players will play optimally.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] coin changing problem

2010-10-05 Thread sharad kumar
int denom(int Coin[],int n,int amount)
{
for(i=0;i wrote:

> Hi all,
>
> Pls help me with the solution to the following problem related to the coin
> changing problem.
>
> suppose that the available coins a ein the denominations c^0, c^1 , c^2...
> c^k for some intgers  c>1 and k>=1. show tht the greedy algorithm always
> yeilds an optimal solution
>
> thanks in advance
> Preethi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] repeating numbers in an array

2010-10-02 Thread sharad kumar
it will take same amount of memory nakey value is element and vaule is
the amount of times element occurs.

On Sun, Oct 3, 2010 at 11:11 AM, mac adobe  wrote:

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



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] repeating numbers in an array

2010-10-02 Thread sharad kumar
cant u use a hash map buddy???

On Sun, Oct 3, 2010 at 10:35 AM, mac adobe  wrote:

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



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] finding largest and second largest elements

2010-09-27 Thread sharad kumar
hey isn't it suppposed to be tournament problem..

On Fri, Sep 24, 2010 at 12:06 AM, Divesh Dixit <
dixit.coolfrog.div...@gmail.com> wrote:

> finding largest and second largest elements from a set of n elements
> by means of
>  Minimum comparison of  n+celling(log 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Write C code for providing MAC address as output given the IP address as input

2010-09-22 Thread sharad kumar
u wanted to implement arp protocol???

On Wed, Sep 22, 2010 at 7:30 PM, PCM  wrote:

> Write C code for providing MAC address as output given the IP address
> as input..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Help required

2010-09-22 Thread sharad kumar
hey ya man I was also searching for tat ione
, Sep 22, 2010 at 8:37 PM, Nikhil Agarwal  wrote:

> @ankur Please give me a proper link.I mean with hash after 4shared.com
>
> On Wed, Sep 22, 2010 at 11:26 AM, ankur aggarwal  > wrote:
>
>> http://www.4shared.com/
>>  check it..
>>
>>  On Wed, Sep 22, 2010 at 12:00 AM, Nikhil Agarwal <
>> nikhil.bhoja...@gmail.com> wrote:
>>
>>>  Can anybody share his/her E-copy of An Introduction to algorithm by Udi
>>> manber.It's a great resource.If anybody has please share his E-copy.Thanks
>>> in advance.
>>>
>>> --
>>> Thanks & Regards
>>> Nikhil Agarwal
>>> Senior Undergraduate
>>> Computer Science & Engineering,
>>> National Institute Of Technology, Durgapur,India
>>> http://tech-nikk.blogspot.com
>>> http://beta.freshersworld.com/communities/nitd
>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>>
>> With Regards
>> Ankur Aggarwal
>> +91-7838289304
>>
>> Software Engineer
>> Slideshare
>> Delhi
>> INDIA.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks & Regards
> Nikhil Agarwal
> Senior Undergraduate
> Computer Science & Engineering,
> National Institute Of Technology, Durgapur,India
> http://tech-nikk.blogspot.com
> http://beta.freshersworld.com/communities/nitd
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] A help please

2010-09-22 Thread sharad kumar
it accepts input into a,b an prints garbage value cos scanf returns the
number of values that accept nput ad in printf there is no variable from
where value is printed

On Wed, Sep 22, 2010 at 2:25 PM, rahul rai  wrote:

> "printf("%d%d",scanf("%d%d",&a &b))"
>
> --
> Rahul K Rai
> rahulpossi...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] recursion to remove duplicate characters in a string

2010-09-21 Thread sharad kumar
instead of creating a bst why dontwe create a heap.then sort the heap .then
remove the duplictes from string...but will also chnge th order of
string.

On Sun, Sep 19, 2010 at 4:20 PM, Umer Farooq  wrote:

> creating a bst would require extra space. You can do this with an array of
> char dude.
>
> On Sun, Sep 19, 2010 at 3:31 PM, LG JAYARAM .  wrote:
>
>> hi buddy ...Im clear with the ideahereby I share the concept...
>>
>> wat exactly need to be done to solve this task isbetter create a
>> Binary search tree...the Binary search tree will not allow duplicates and If
>> u perform a inorder traversalu can get the result...the task is
>> oversimple and thts it.
>>
>>  On Sat, Sep 18, 2010 at 11:12 PM, jagadish wrote:
>>
>>> You are given a string which is sorted.. Write a recursive function to
>>> remove the duplicate characters in the string.
>>> eg: potatoeos
>>> output: potaes
>>> NO extraspace like hash/ bitmaps..
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Umer
>
> --
>  You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: do this: sorting using reverse()

2010-09-16 Thread sharad kumar
its similar to performing a right rotatate within the specifie boundary the
number of times specified by argument

On Thu, Sep 16, 2010 at 11:49 PM, Aurelian Tutuianu wrote:

> A naive way to implement that is:
>
>int[] v = new int[100]; // this is my vector with values
>
>for (int i = v.length - 1; i >= 0; i++) {
>// get maximum value
>int max = Integer.MIN_VALUE;
>for (int j = 0; j < v.length; j++) {
>if (max < v[j]) {
>max = j;
>}
>}
>// put max value on first position
>rev(max);
>// put max value on proper position
>rev(i);
>}
>
> 2*n calls to rev. (the fact that the find max is a naive approach does
> not count, according to problem)
>
> On Sep 16, 6:41 pm, Srinivas  wrote:
> > You have been given a function rev(x) which works as follows:
> > It reverses a[0] to a[x] elements of a.
> > e.g. Given array is
> > a : 1 8 3 4 5
> > rev(3) will convert the array to
> > a : 4 3 8 1 5
> > Use this function only (and comparison, of course) to sort given array
> > 'a'. The only criterion is
> > that the number of times this function is called should be minimum.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: Amazon Question

2010-09-15 Thread sharad kumar
you dont have the structure of the node

typedef  struct member node
{
int data;
struct member * next;
}ll;

On Tue, Sep 14, 2010 at 5:57 PM, soundar  wrote:

> From first linked list set flag value in each traversal of
> node..then start from second linked list suppose if flag value is
> already set that is the intersection point
>
> correct me if i am wrong
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] sql queries

2010-09-13 Thread sharad kumar
teach ur self sql in 24 hrs. or use oracle complete guide.the fat book

On Tue, Sep 14, 2010 at 6:50 AM, Ayush Mittal wrote:

> can anybody tell me how to command on sql queries?
> please refer books and sites where i can practice important
> queries.!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] number of inversion pairs

2010-09-13 Thread sharad kumar
linear decreasing sub sequence problem



On Mon, Sep 13, 2010 at 9:10 PM, Raj N  wrote:

> Given an array of n integers find all the inversion pairs in O(n)
> Inversion pair is one where a[i]>a[j], i
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: Amazon Question

2010-09-13 Thread sharad kumar
cant it be like '%f%'

On Mon, Sep 13, 2010 at 2:55 PM, Praveen Baskar wrote:

> i think that we have to generate substrings from the given string such that
> the similarity is above 50%
> for eg.
> word ="foo"
> we have to generate the strings which must be greater than half of the
> given string length
> {"fo","oo"} (in this case)
>
> after this operation we have the following string set {"foo","fo","oo"}
>
> then we can doselect* from product where name like '%foo%'select*
> from product where name like '%fo%'. select* from product where name
> like '%oo%'
>
>
> please do correct me if i am wrong
>   On Mon, Sep 13, 2010 at 1:01 PM, SVIX 
> wrote:
>
>> select * from product
>> where
>> name like '%foo%'
>> and len(name) <=6;
>>
>> btw, how do u define similarity? i'm guessing it wouldn't be this
>> simple...
>>
>> On Sep 12, 5:12 am, Snoopy Me  wrote:
>> > You are given the amazon.com database which consists of names of
>> > millions of products. When a user enters a search query for particular
>> > object with the keyword say "foo" , output all the products which have
>> > names having 50% or more similarity with the given keyword ie "foo"
>> >
>> > Write the most efficient algorithm for the same.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> By B. Praveen
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Amazon Question

2010-09-12 Thread sharad kumar
pagerank algo

On Sun, Sep 12, 2010 at 5:42 PM, Snoopy Me  wrote:

> You are given the amazon.com database which consists of names of
> millions of products. When a user enters a search query for particular
> object with the keyword say "foo" , output all the products which have
> names having 50% or more similarity with the given keyword ie "foo"
>
> Write the most efficient algorithm for the same.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] On random no. generation

2010-09-11 Thread sharad kumar
we have discussed this problem before pls check the archives

On Sun, Sep 12, 2010 at 7:37 AM, sourav  wrote:

> You are given a random no. generator function rand04() that generates
> random numbers between 0 and 4 (i.e., 0,1,2,3,4) with equal
> probability. You have to design a random no. generator function
> rand07() that generates numbers between 0 to 7 (0,1,2,3,4,5,6,7) using
> rand04() such that rand07() generates all numbers between 0 to 7 with
> equal probability.
>
> How will you do that?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] array divide problem

2010-09-05 Thread sharad kumar
find sum of array.let it be =S
nw we need to find the S/2 then find out which elements that add to S/2 llr
to knpsack..

On Sun, Sep 5, 2010 at 8:07 PM, Raj Jagvanshi wrote:

> There is an array of some no only 0-9.
>  You have to divide it into two array
> such that sum of elements in each array is same.
>   Eg input   {1,2,3,4}  output  {1,4}{2,3}
>
>
> this question of nagaroo company
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] National Instruments: linked list subtraction

2010-08-25 Thread sharad kumar
make use of two ptr approach.first traverse the first linkd list and fnd k
th element from last where k is the length of subrahend then perform
subtraction.

On Wed, Aug 25, 2010 at 8:18 PM, Raj N  wrote:

> My approach:
> Use divide and conquer approach. i.e divide(a) divide(b) i.e first list and
> divide(c) divide(d) of second list recursively (like mergesort). Then apply
> subtract(a,c) and subtract(b,d)
>
> It goes this way:
> Make both lists of equal length by appending 0s at the beginning of smaller
> list. Assuming list1 > list2
> struct node
> {
> int data;
> struct node *next;
> };
>
> void divide(struct node* root1,struct node *root2)
> {
> struct node *a;
> struct node *b;
> struct node *c;
> struct node *d;
> struct node *result;
> int borrow=0;
>
> if(root1==NULL || root1->next==NULL)
>   return;
> else
> {
>   split(root1,&a,&b);
>   split(root2,&c,&d);
> }
> if(b->next==NULL && a->next==NULL)
> {
> subtract(b,d,&borrow,&result);
> subtract(a,c,&borrow,&result);
> }
> }
>
> void split(struct node* source, struct node **front, struct node **back)
> {
> struct node *slow, *fast;
> slow=source;
> fast=source->next;
>
> while(fast!=NULL)
> {
>fast=fast->next;
>if(fast!=NULL)
>{
>   slow=slow->next;
>   fast=fast->next;
> }
>   }
>  *front=source;
>  *back=slow->next;
>   slow->next=NULL;
> }
>
> void subtract(struct node *n1, struct node *n2, int *borrow,struct node
> **result)
> {
>  *result=(struct node*)malloc(sizeof(struct node));
>  if(n1->data >= n2->data && !borrow)
>  {
>   result->data = n1->data - n2->data;
>
>  }
>   else if(n1->data > n2->data && borrow)
>   {
> result->data = (n1->data-1) - n2->data;
> borrow = 0;
>   }
>else if(n1->data < n2->data && !borrow)
>{
>   result->data = (n1->data + 10) - n2->data;
> borrow=1;
>}
>else if(n1->data <= n2->data && borrow)
>{
>  result->data = (n1->data+9) - n2->data;
>}
>
> // Insert the new node result at the beginning of result list
> }
>
> Tell me if there're any corrections !!
>
>
>  On Wed, Aug 25, 2010 at 3:24 PM, Raj N  wrote:
>
>> Input : Two large singly linked lists representing numbers with most
>> significant digit as head and least significant as last node.
>> Output: Difference between the numbers as a third linked list with
>> Most significant digit as the head.
>> Eg:
>> ---
>> Input:
>> A = 5->4->2->0->0->9->0->0
>> B = 1->9->9
>> Output:
>> C = 5->4->2->0->0->7->0->1
>> Required complexity :
>> O(n)
>> Constraint:
>> Reversing linked list is NOT allowed
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>   --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: Longest Palindromic Substring

2010-08-19 Thread sharad kumar
u can use a suffix tree

On 8/19/10, Saikat Debnath  wrote:
>
> Isn't the longest palindromic substring is alevela???
>
> On Aug 19, 7:16 pm, Nikhil Jindal  wrote:
> > Hi All,
> >
> > Givan a string, you have to find the longest palindromic substring.
> > For ex: Longest Palindromic substring for abclevelabc is level.
> >
> > What is the most optimised solution possible?
> >
> > Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Shuffling a deck of cards

2010-08-14 Thread sharad kumar
for(i=0;i<52;++i)
{
int r=rand()%52;
swap(a[i],a[r]);
}

On Sat, Aug 14, 2010 at 11:46 PM, amit  wrote:

> write a program to shuffle an pack of cards in the most efficient way.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] minimum window containing charecters

2010-08-11 Thread sharad kumar
@all:u need to calculate the hash value of very substring(no other go since
the letters are in different order we ought to do it).then apply Rain
Karp  algorithm.

On Wed, Aug 11, 2010 at 2:43 PM, Algoose chase  wrote:

> @ Anand, No , It doesnt
>
> Try with String2 = "LH"
> String1 = "HELLO".
> I think LCS solves a different problem from the one being asked here.
>
> I think we must generate all possible combination of strings  and for each
> combination , check if all chars from str2 is present in it.
>
> On Sun, Aug 1, 2010 at 11:54 PM, Anand  wrote:
>
>>
>> Even if they are not in the same order still it works
>>
>> http://codepad.org/jpCUqwpA
>>
>>  
>> On Sun, Aug 1, 2010 at 10:52 AM, srikanth sg wrote:
>>
>>> dude they dont need to be in the same order ..
>>> how are taking care of that
>>>
>>>
>>> On Sun, Aug 1, 2010 at 10:47 AM, Anand  wrote:
>>>
 Using Dynamic programing(Longest common subsequence logic) we can solve
 this problem in O(nm) where n is the length of the first string and m is 
 the
 length of second string. Last element of matrix which the length of the
 string that matches.

 http://codepad.org/cyiKEMSF

  

 On Sun, Aug 1, 2010 at 8:13 AM, srikanth sg 
 wrote:

> plz .. if any one knows dp solution then tell ...
>
>
> On Sun, Aug 1, 2010 at 7:31 AM, Ashim Kapoor wrote:
>
>> I am not sure, but can I do this using a suffix trie ? any comments ?
>>
>>
>>
>>
>> On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel wrote:
>>
>>> solution could be to find the charcter position from both sides for
>>> each char of s2
>>> then from the 2*n array, find the smallest index from left and
>>> largest from right, within these two indexes all chars would be there
>>>
>>> one case where one of the chars can be missing can be found if a row
>>> in this 2-d array remains unmodified
>>>
>>>
>>>
>>> Best Regards
>>> Ashish Goel
>>> "Think positive and find fuel in failure"
>>> +919985813081
>>> +919966006652
>>>
>>>
>>>
>>> On Sat, Jul 31, 2010 at 10:22 PM, Nikhil Jindal <
>>> fundoon...@yahoo.co.in> wrote:
>>>
 At the moment, I can only think of an O(n^3) algo.
 Maybe if you can find a hash function which computes the hash value
 depending on the unique characters the string contains, you can reduce 
 it to
 O(n^2).


  On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg <
 srikanthini...@gmail.com> wrote:

> given two string , find the minimum  width in string 1 containing
> the
> all characters of string 2 , they may present in different order
> string 1-HELLO
> string 2- LE
> answer-2
>
> --
> 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.
>
>
 Please access the attached hyperlink for an important electronic 
 communications disclaimer: 
 http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php











 --

 You received this message because you are subscribed to the Google 
 Groups "Algorithm Geeks" group.

 To post to this group, send email to algoge...@googlegroups.com.

 To unsubscribe from this group, send email to 
 algogeeks+unsubscr...@googlegroups.com 
 .


 For more options, visit this group at 
 http://groups.google.com/group/algogeeks?hl=en.



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

Re: [algogeeks] closest pair problem

2010-08-11 Thread sharad kumar
hi,
I feel we have  discussed the  solution to this problem using DP.ts in
archives.pls check  it

On Wed, Aug 11, 2010 at 11:17 PM, Raj N  wrote:

> Hi,
> Can someone give me the code for finding closest pair of points using
> divide and conquer strategy?
> Thanks !!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Microsoft Question

2010-08-09 Thread sharad kumar
nice onefor searching first u need to build the suffix tree for each
letter with * once u do it perform a search
in other word u need to implement grep command rite??
On Mon, Aug 9, 2010 at 7:00 PM, amit  wrote:

> Given a text file, implement a solution to find out if a pattern
> similar to wild cards can be detected.
> fort example find if a*b*cd*, or *win or *def* exists in the text.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] bitwise operator confusion

2010-08-08 Thread sharad kumar
in case of -ve numbers irrspectiveof size of compilerits repesented as 
in remanig space apart from the space of binaryequivalent of number.hence u
get 

On Sun, Aug 8, 2010 at 9:37 PM, navin  wrote:

> Assunming, integer is 2 byte, What will be the output of the program?
>
> #include
>
> int main()
> {
>printf("%x\n", -1>>1);
>return 0;
> }
>
> [A].
> [B].0fff
> [C].
> [D].fff0
>
> Answer: Option A
>
> i dont understand why it produces 
> actually -1  = 
> there shoud be one bit zero ( ie msb. )
> pls explain anyone.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] BST sort

2010-08-06 Thread sharad kumar
perform inorder traversal...and store it in same array...

On Thu, Aug 5, 2010 at 7:10 PM, AlgoBoy  wrote:

> sort a BST represented like an array...(similar to representation of
> HEAP)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: BST Problem

2010-08-06 Thread sharad kumar
do the inorder traversal of the bst ...this gives the sorted array..
from that use

int i=0,j=length(array)
while(isum)
--j;
else if(array[i]+array[j] wrote:

> Two inorders would achieve the same thing without using an array. One
> pointer running inorder with LDR and other pointer running inorder with RDL.
> Compare the sum at the two nodes and then adjust them accordingly.
>
> On Fri, Aug 6, 2010 at 2:11 PM, Manjunath Manohar <
> manjunath.n...@gmail.com> wrote:
>
>> the solution elegant..but is there any on the fly method by just
>> exploiting the BST propertyby using left and right pointers
>>
>> --
>>  You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Merging Companies Problem

2010-07-31 Thread sharad kumar
Cant u slit it s n/2 companies and merge them recursively .like x^y the
multiply  x to y/2 time and then multiply tht product twice.

On Sat, Jul 31, 2010 at 6:59 PM, sourav  wrote:

> Suppose we start with n companies that eventually merge into one big
> company. How many different ways are there for them to merge?
>
> With three companies {a,b,c}, we need to find the number of ways that
> the three companies can become two companies, and for every one of
> those possibilities, the two remaining companies can be reduced to one
> in only 1 way (because we've already solved the case of two
> companies). In the case of {a,b,c}, we can have 1 * [{ab,c}, {ac,b},
> {bc,a}], or 3.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] number of BST's

2010-07-29 Thread sharad kumar
@amit is it BST or binary tree??cos BST is unique rite???binary tree meas
use catalan numbers 2nCn/(n+1)!



On Thu, Jul 29, 2010 at 9:56 PM, amit  wrote:

> Given the numbers from 1 to n, write an algorithm to find how many
> distinct binary search trees can be formed.. eg n=4, no of distinct
> bst's are 14. ??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Oracle-Java Developer interview question

2010-07-26 Thread sharad kumar
shldnt max width be equal to diameter of the treecorrect me if im
wrong

On Mon, Jul 26, 2010 at 1:28 PM, vineel yalamarth <
vineelyalamar...@gmail.com> wrote:

>
>
> Dear Sharad,Maximum width of the tree you had drawn is 2...(3,8),(1,4)
>
>
>
>
> --
>  You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Oracle-Java Developer interview question

2010-07-26 Thread sharad kumar
  5
 /  \
 3  8   max width is 4 (1-3-5-8) am i riteif so then use the approach as
i stated earlier ...
/  \
1  4
On Mon, Jul 26, 2010 at 1:03 PM, Sathaiah Dontula wrote:

> I mean "maximum number of nodes in a breadth of a BST".
>
> Thanks,
> Sathaiah
>
>   On Mon, Jul 26, 2010 at 1:00 PM, sharad kumar 
> wrote:
>
>>  the max width of bst is the largets diff betweeen the min node and max
>> node rite?
>>
>>
>> On Mon, Jul 26, 2010 at 12:30 PM, Chunyuan Ge  wrote:
>>
>>> breadth-favorite search?
>>>
>>>
>>> On Mon, Jul 26, 2010 at 2:28 PM, Sathaiah Dontula 
>>> wrote:
>>>
>>>> You mean maximum width of bst ?
>>>>
>>>> You can use BST to find the same.
>>>>
>>>> Thanks,
>>>> Sathaiah
>>>>
>>>>
>>>> On Mon, Jul 26, 2010 at 11:47 AM, aparichith <
>>>> vineelyalamar...@gmail.com> wrote:
>>>>
>>>>> Can some one tell me the algorithm to find out the width of a binary
>>>>> search tree.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>> --
>>>  You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> yezhu malai vaasa venkataramana Govinda Govinda
>>
>> --
>>   You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Oracle-Java Developer interview question

2010-07-26 Thread sharad kumar
the max width of bst is the largets diff betweeen the min node and max node
rite?

On Mon, Jul 26, 2010 at 12:30 PM, Chunyuan Ge  wrote:

> breadth-favorite search?
>
>
> On Mon, Jul 26, 2010 at 2:28 PM, Sathaiah Dontula wrote:
>
>> You mean maximum width of bst ?
>>
>> You can use BST to find the same.
>>
>> Thanks,
>> Sathaiah
>>
>>
>> On Mon, Jul 26, 2010 at 11:47 AM, aparichith 
>> wrote:
>>
>>> Can some one tell me the algorithm to find out the width of a binary
>>> search tree.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
>  You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] find k-th maximum in an unsorted array

2010-07-22 Thread sharad kumar
hey this question was discussed earlier rite???pls make use of Selection
algorithm...i think the worst  case is O(n+logn).
http://en.wikipedia.org/wiki/Selection_algorithm

On Thu, Jul 22, 2010 at 9:53 PM, Tech Id  wrote:

> Write an algo (in less than O(n^2)) to find k-th maximum in an
> unsorted array of integers.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: Adobe Strings matching Puzzle.

2010-07-22 Thread sharad kumar
@all:pls make use of KMP algorithm...because knuth morris prat algor

On Wed, Jul 21, 2010 at 6:16 PM, anugrah  wrote:

> Stack can be used to push the characters of the string A and then
> popped off while scanning through the string B until there is a
> difference in the character read from the string B and the one popped
> off from the stack..
>
> On Jul 20, 4:40 pm, agnibha nath  wrote:
> > You can try rabin-carp..
> >
> > On Jul 20, 4:18 pm, mallesh  wrote:
> >
> > > We are given two strings. A and B.
> >
> > > First few letters of A match with Last letters of B. We have to find
> > > the longest match in linear time.
> > > Example:
> > > char * A ="This is my first post to this group";
> > > char *B= "to this group this is my post";
> >
> > > Algorithm should return starting position of substring "to this group"
> > > in string A.
> >
> > > How do we do this?
> >
> > > -Thanks and regards,
> > > Mallesh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Entryinto elite companies

2010-07-20 Thread sharad kumar
@aparichit:c brother u need to live,breathe enjoy algorithms not studyU
shldnt limit ur choice that just because you want to get placed in MS/Google
you want to do coding.You need to pursue coding as a career .you need to
do it for your self not for entering the company.even if you dont
make into MS atleast feel that you are specialI've knw guys here  in US
who havent attended schools but have startedc their own firms which are
listed in nasdaq which take on MS/Google.in short i would like to say gain
knwledge and pursue excellence..

On Wed, Jul 21, 2010 at 10:49 AM, aparichith wrote:

> Guys, Can some one tell me how to enter into elite companies like
> Yahoo, Microsoft,Symantec ,Amazon etc.. I did my engineering in IT in
> India , but I 'm not that phodu in coding etc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



[algogeeks] b tree:

2010-07-13 Thread sharad kumar
Find the median in B-tree of order n

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



Re: [algogeeks] Re: 32 comparisons only

2010-07-13 Thread sharad kumar
@tech id
i think in this case we are just optimizing number of comparisons
if n is very large use tradational methods like binary or linear search

-- 
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] xoring

2010-07-11 Thread sharad kumar
given a set of numbers
u hve to find the pair which give maximum value if we xor that pair
ex a={1,3,6,7,8,9}
then ans is 15 as 7 xor 8

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



Re: [algogeeks] recursive

2010-07-11 Thread sharad kumar
@harit
if that is d case plz
post d link 4 this ques.
remember if u dont want to discuss these ques,u can any time ignore this
mail ,let others who are not as sharp as u discuss these questions.
PS:this is d ques by amazon in 3rd round of interview

-- 
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] geometry

2010-07-10 Thread sharad kumar
Given a set of points, find the line that intersects the most number of
points

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



Re: [algogeeks] graph:

2010-07-10 Thread sharad kumar
how to do second part
it requires log k matrix multiplication
thus o(n3 log n)
plzz xplain

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



Re: [algogeeks] graph:

2010-07-10 Thread sharad kumar
an adjacency matrix

On Sun, Jul 11, 2010 at 8:45 AM, sharad  wrote:

> A graph is given. You need to design a data structure with minimum
> space complexity such that it does the follows--> Finds whether nodes
> u and v have a path in between them in O(1) time.--> Finds whether
> there is a path of length k between u and v in O(k) time.The same data
> structure to be used for both the purposes.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: amazon:-

2010-07-10 Thread sharad kumar
@jalaj
how u make graph
so that we can apply dijkasta algo
plz xpalain

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



Re: [algogeeks] Graphs.

2010-07-10 Thread sharad kumar
if adjacency matrix is given then try to check if adj[i][j]==1 and
adj[j][i]==1

On Sat, Jul 10, 2010 at 9:24 AM, Amit Jaspal wrote:

> @ jalaj
> consider a graph
>
> 2->1
> 3->1
> 2->3
>
> apply dfs(1) n dfs(2)...
> will give u 2 components although GRAPH is connected
>
>
> On Fri, Jul 9, 2010 at 10:23 PM, jalaj jaiswal 
> wrote:
>
>>
>> int count=0;
>> for every vertex v{
>>  if visited[v]==0
>>   dfs(v)
>>   count++;
>>  }
>> count is the number of components in graph or m i missing
>> something ?
>>
>>
>> On Fri, Jul 9, 2010 at 9:23 PM, amit  wrote:
>>
>>> How to check if a directed graph is connected.
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> With Regards,
>> Jalaj Jaiswal
>> +919026283397
>> B.TECH IT
>> IIIT ALLAHABAD
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
>  You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



[algogeeks] recursive

2010-07-10 Thread sharad kumar
How to do level order traversal using recursion ?

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



Re: [algogeeks] HIEGHT

2010-07-08 Thread sharad kumar
@anand
i want iterative not recursive soln

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



Re: [algogeeks] Re: microsoft.

2010-07-08 Thread sharad kumar
@souravsain
i want 2 in your example

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



Re: [algogeeks] google

2010-07-07 Thread sharad kumar
@topojoy
ur understanding of problem is fully correct

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



Re: [algogeeks] microsoft.

2010-07-07 Thread sharad kumar
ya i want inplace soln

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



Re: [algogeeks] amazon:-

2010-07-07 Thread sharad kumar
this the same hamming distance problem...this can be done thorugh
trie.pls check archives this has been discussed before..

On Wed, Jul 7, 2010 at 10:12 AM, Ashish Goel  wrote:

> use levenstein distance algo
>
>
> http://en.wikipedia.org/wiki/Levenshtein_distance
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
> On Tue, Jul 6, 2010 at 9:30 PM, sharad kuma
>
> r  wrote:
>
>> Given a string A, and a string B, and a dictionary, how would you convert
>> A to B in the minimum no of operations, given that:
>>
>> i) All the intermediate words must be from the dictionary
>>
>> ii) An ‘operation’ is defined as:
>>
>> a) Delete any character from a string ex dog → do
>>
>> b) Insert any character into a string ex cat → cart
>>
>> c) Replace any character in the string with another ex cat → cot
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Plz help with multidimensional array

2010-07-07 Thread sharad kumar
@ashish cant u make use of char *p[30] for 2 d array
On Wed, Jul 7, 2010 at 9:34 AM, Ashish Goel  wrote:

> char name[][10] is a auto variable on stack, so no pointers here
>
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
>
> On Wed, Jul 7, 2010 at 9:10 AM, UMESH KUMAR wrote:
>
>>
>> char name[][10]={"jan","feb","march"};
>>
>> Name is a  2-D Array  of character so if you wish to store in a
>> Pointer variable
>>then must take a  Character of Pointer of 10 characters of type char.
>>char (*p)[10]=name;
>>
>> Umesh Kumar
>>  MCA
>> D.U.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Need good hashing implementations in Linux (C/C++)

2010-07-07 Thread sharad kumar
hash map in c++ stl makes use of rb trees since insertion and deletion take
place in O(logn) feel its effficientand more over u can just use single
line to use hash map for any data type

On Tue, Jul 6, 2010 at 3:28 PM, Prashanth  wrote:

> Hi all!
>
> I need some good hash implementations. I am able to find couple of
> them but I don't know their quality/performance. Please let me know
> something which you have used and tested.
>
> Thank you,
>
> Regards,
> Prashanth
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] ipc

2010-07-07 Thread sharad kumar
@harit why pipes are fastest...plzz explain a bit

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



[algogeeks] amazon:-

2010-07-06 Thread sharad kumar
Given a string A, and a string B, and a dictionary, how would you convert A
to B in the minimum no of operations, given that:

i) All the intermediate words must be from the dictionary

ii) An ‘operation’ is defined as:

a) Delete any character from a string ex dog → do

b) Insert any character into a string ex cat → cart

c) Replace any character in the string with another ex cat → cot

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

2010-07-06 Thread sharad kumar
Given an array of n numbers in which all the members are less than or equal
to k (khttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] ipc

2010-07-05 Thread sharad kumar
which is the fastest IPC mechanism between Semaphores, Monitors, Message
passing and Signals

-- 
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] isr

2010-07-05 Thread sharad kumar
You have a system in which there is a timer that interrupts the system every
20ms. If the system is interrupted, an ISR runs to handle that interrupt.
How will you design your system to find if that ISR runs for more than 20ms
[in most cases an ISR will be very short...but assume in this case its not]
?

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



Re: [algogeeks] array

2010-07-05 Thread sharad kumar
@amir
if it is 2n+k
then how do u proceed
ur soln become O(kn)

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



Re: [algogeeks] merge sorted lists

2010-07-05 Thread sharad kumar
@divya complexity according to ur ques shud be O(klog n)  (thats what i
think ... i may be wrong)
plzzz check 4m source where u take ques

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



Re: [algogeeks] shift operators

2010-07-05 Thread sharad kumar
 For signed values, if the high-order bit is a 1, the number is negative.
(This is true for 1's complement, 2's complement, and sign-magnitude
representations.) If you were using a right shift to implement division,
you'd want a negative number to stay negative, so on some computers, under
some compilers, when you shift a signed value right and the high-order bit
is 1, new 1 bits are shifted in at the left instead of 0s. However, you
can't depend on this, because not all computers and compilers implement
right shift this way. In any case, shifting negative numbers to the right
(even if the high-order 1 bit propagates) gives you an incorrect answer if
there's a remainder involved: in 2's complement, 16-bit arithmetic, -15 is
0xfff1, so -15 >> 1 might give you 0xfff8shifted which is -8. But integer
division is supposed to discard the remainder, so -15 / 2 would have given
you -7. (If you're having trouble seeing the way the shift worked, 0xfff1 is
00012 and 0xfff8 is 10002. The
low-order 1 bit got shifted off to the right, but because the high-order bit
was 1, a 1 got shifted in at the left.)

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



Re: [algogeeks] oops

2010-07-05 Thread sharad kumar
i also think same for the first answer

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



Re: [algogeeks] Re: isbst

2010-07-04 Thread sharad kumar
@dheeraj
for this tree inorder is 12 14 13
first 12 comes,it is saved in temp
now 14 comes since 14>12 so temp =14
now when 13 comes which is less than temp hence not a bst
correct me if i wrong

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



Re: [algogeeks] Re: merge sorted lists

2010-07-04 Thread sharad kumar
@dave
u r rite its my fault

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



[algogeeks] amazon

2010-07-03 Thread sharad kumar
You are given an array ' containing 0s and 1s. Find O(n) time and O(1) space
algorithm to find the maximum sub sequence which has equal number of 1s and
0s.

Examples
1) 10101010
The longest sub sequence that satisfies the problem is the input itself

2)1101000
The longest sub sequence that satisfies the problem is 110100

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



Re: [algogeeks] amazon question

2010-07-03 Thread sharad kumar
@ashish
i think only preorder wont do d trick can u pl explain how to
deserialize it only using preorder

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



Re: [algogeeks] merge sorted lists

2010-07-03 Thread sharad kumar
1. First take two lists at a time and merge them so total elements parsed
for all lists =O(n)
This operation results in k/2 lists
2. Repeat steps till k/2 == 1.

*Time complexity of above solution = O(n logk)*
Step1 would loop through *logk *times and each operation would require
parsing all n elements in all the lists for making k/2 lists

eg:: if i had 8 lists then first pass would make 4 lists by parsing all n
elements; second pass would make 2 lists by parsing again n elements and
third pass would give 1 list again by parsing n elements.

*Constraint of the above Solution*
For merging we would require *O(n) *extra space.

*Solution2: Without Using O(n) extra space; uses O(k) extra space*
**j = 1;
1. (For all lists L[i])
{
Take the jth element from each list and create a min heap in O(k) with the
node data and
index information. Take the minimum element from the heap in O(1) i.e. root
node and put
it in *List1 indexj.*
**if the element didn't belong to list1[j] then swap it with list1[j] with
list to which the min
element belonged.
Now increment the pointer j for the list l1(or to the list where in the min
nodes are getting added) and add the new node to min heap
}
2. Keep repeating steps 1 till all n elements are being looked up

*Time Complexity = O(n logk ) SPACE = O(k)*
At a time we have k elements min heap and for all n elements we have to
readjust the heap in log(k) time so total time = *O(n logk )* and space used
= *O(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.



Re: [algogeeks] google

2010-07-03 Thread sharad kumar
@harit
can u pl elaborate how we can do c part of ques  by hashing in o(1) time

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



Re: [algogeeks] cops n robber

2010-07-03 Thread sharad kumar
is it possible if they hve different speed like cop can run faster

-- 
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] cops n robber

2010-07-03 Thread sharad kumar
Two cops and a robber are located on opposite corners of a cube and move
along its edges. They all move at the same rate. Is it possible for the cops
to catch the robber.
[Each of the 3 people can see each other at all times and can react
instantaneously to each others movements. Stopping is allowed.

-- 
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] google favourite ques

2010-07-03 Thread sharad kumar
explain in detail what happens in all d 7 layers of osi model when u type
www.google.com in ur browser

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



Re: [algogeeks] Binary trees with 3 nodes

2010-07-02 Thread sharad kumar
catalan numbers.(2n)Cn/(n+1)

On Sat, Jul 3, 2010 at 1:06 AM, Raj N  wrote:

> How to find all the possible trees with 3 nodes from a given tree
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



[algogeeks] lru cache

2010-07-02 Thread sharad kumar
how would u implement LRU cache

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



Re: [algogeeks] Re: isbst

2010-07-02 Thread sharad kumar
i read that link ,i dont think that is very efficient,someone plzzz look at
that soln n comment
bcoz i m really confused in this isbst ques so plzzz

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



Re: [algogeeks] BST with duplicates?

2010-07-01 Thread sharad kumar
no a bst cant hve duplicates

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



Re: [algogeeks] point lying inside or not

2010-07-01 Thread sharad kumar
@jalaj ur method fail when it is lying on the corner
plzz consider case for that also

-- 
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] microsoft

2010-07-01 Thread sharad kumar
Imagine a disk spinning like a record player turn table. Half of the disk is
black and the other is white. Assume you have an unlimited number of color
sensors. How many sensors would you have to place around the disk to
determine the direction the disk is spinning? Where would they be placed?

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



Re: [algogeeks] OS problems

2010-07-01 Thread sharad kumar
i think harit's answer is correct regarding ques 2 plzz someone comment on
this

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



Re: [algogeeks] Re: point lying inside or not

2010-07-01 Thread sharad kumar
@dave thnx now i understood the soln

@sharad can u tell me how it can be done using convex hull algo

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



Re: [algogeeks] point lying inside or not

2010-07-01 Thread sharad kumar
@sharad:make use of convex hull algorithm.i feel that should do the
trick.

On Thu, Jul 1, 2010 at 9:48 AM, sharad kumar wrote:

> a polygon is given(convex or concave)
> given a point u have to find whether it is lying inside polygon or not
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] computational geometry

2010-07-01 Thread sharad kumar
@Amir
i m not able to understand how complexity is o(n) if u r doing for all
vertices...plzz elaborate

-- 
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] point lying inside or not

2010-07-01 Thread sharad kumar
a polygon is given(convex or concave)
given a point u have to find whether it is lying inside polygon or not

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



Re: [algogeeks] complete binary tree

2010-06-30 Thread sharad kumar
@sharad :we need to check at each intermediate level there are 2^n nodes so
do a bfs...also perfom the count of left subtree and right subtree where
count(left subtree)>count(right subtree))

On Tue, Jun 29, 2010 at 11:34 PM, sharad kumar wrote:

> A *complete binary tree* is a binary tree in which every level, *except
> possibly the last*, is completely filled, and all nodes are as far left as
> possible
> write a code which check whether a given tree is complete or not
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] Re: sort 0's 1's and 2's

2010-06-30 Thread sharad kumar
@above
all d above algo are not stable

@anil
counting sort is not inplace

@ankur
yes it is dutch national problem but here i think
it is taking 2 iterations bt i want to noe can i do it in 1 traversal
although still o(n)

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



Re: [algogeeks] second shortest path

2010-06-30 Thread sharad kumar
@divya
thnx for d detailed explaination...now its clear 2 me...nice approach

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



Re: [algogeeks] Re: n ary tree symmetry

2010-06-30 Thread sharad kumar
@gene
i tried but unable to extend it to n ary tree...can u plzz extend it to n
ary ...
thnx in advance..

-- 
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] complete binary tree

2010-06-29 Thread sharad kumar
A *complete binary tree* is a binary tree in which every level, *except
possibly the last*, is completely filled, and all nodes are as far left as
possible
write a code which check whether a given tree is complete or not

-- 
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] sort 0's 1's and 2's

2010-06-29 Thread sharad kumar
how to sort an array containing 0's 1's and 2's in O(n)time and sorting
technique must be inplace

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



Re: [algogeeks] crazy

2010-06-29 Thread sharad kumar
ya its 1/2 proof gvn in www.techinterview.org

On Tue, Jun 29, 2010 at 12:37 PM, ankur aggarwal
wrote:

> i think it shud be 1/2.. i will try to prove it...
>
>
> On Mon, Jun 28, 2010 at 8:52 AM, sharad kumar wrote:
>
>> Problem :- A line of 100 airline passengers is waiting to board a plane.
>> They each hold a ticket to one of the 100 seats on that flight. (For
>> convenience, let's say that the nth passenger in line has a ticket for the
>> seat number n.)
>> Unfortunately, the first person in line is crazy, and will ignore the seat
>> number on their ticket, picking a random seat to occupy. All of the other
>> passengers are quite normal, and will go to their proper seat unless it is
>> already occupied. If it is occupied, they will then find a free seat to sit
>> in, at random.
>> What is the probability that the last (100th) person to board the plane
>> will sit in their proper seat (#100)?
>>
>> --
>> 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.
>>
>
>
>
> --
> With Regards
>
> Ankur Aggarwal
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
yezhu malai vaasa venkataramana Govinda Govinda

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



Re: [algogeeks] second shortest path

2010-06-28 Thread sharad kumar
@divya
plzzz elaborate ur approach a bit more...i didnt get u

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



Re: [algogeeks] Re: O(n)

2010-06-28 Thread sharad kumar
i agree with nisha ,if range is not given then count sort is not
applicable..can we apply radix sort bcoz it is also O(kn)...n if we
assume k

  1   2   3   4   >