yeah the solution looks good :-)

On Sat, Mar 26, 2011 at 4:06 PM, kunal srivastav <kunal.shrivas...@gmail.com
> wrote:

> maintain a pointer to the max element so far in every element of the
> stack..
> while push - if the new element is greater than the stack->top->max then
> add the new element at the top and hence make the max pointer of the new
> element point to itself, otherwise the new element is less than the max till
> yet and hence point the max part of the new element to the max part of the
> element at the top
>
> thus at each point the max pointer of the top most element points to the
> current max of the stack
>
> pop - usual, no need to do anything :)
>
> see if you are able to follow this logic. getmax() is O(1) because you just
> need to deference the max part of the top most element at any time
>
> On Sat, Mar 26, 2011 at 3:43 PM, balaji a <peshwa.bal...@gmail.com> wrote:
>
>> yeah it wont remove the element...GetMax() only returns the maximum
>> element added so far......
>>
>>
>> On Thu, Mar 24, 2011 at 9:42 AM, MK <stardust...@gmail.com> wrote:
>>
>>> Actually, you probably mean that GetMax() does not remove it from the DS?
>>>
>>> Sorry for the hasty conclusion.
>>>
>>> On Thu, Mar 24, 2011 at 12:11 AM, MK <stardust...@gmail.com> wrote:
>>> > "2) Design a DS that would do Push(),Pop(), and GetMax() elements at
>>> > complexity O(1)"
>>> >
>>> > Are you sure you remember this correctly? This would give you a way of
>>> > sorting in O(1).
>>> >
>>> > Thanks..
>>> >
>>> >
>>> >
>>> > On Thu, Mar 24, 2011 at 12:09 AM, balaji a <peshwa.bal...@gmail.com>
>>> wrote:
>>> >> The main thing they are testing is Problem Solving and the Algorithm
>>> >> Designing ability. Coding Ability is only next. If you have good
>>> knowledge
>>> >> in Data Structures and good Problem Solving skills with coding ability
>>> you
>>> >> can easily crack through the interview. This is what i infered from my
>>> >> experience.
>>> >>
>>> >> On Thu, Mar 24, 2011 at 12:33 AM, kunal srivastav
>>> >> <kunal.shrivas...@gmail.com> wrote:
>>> >>>
>>> >>> hi people, could someone tell me in detail what all things to prepare
>>> for
>>> >>> amazon including the resources to consult for the same?? it would be
>>> really
>>> >>> helpful
>>> >>>
>>> >>> On Thu, Mar 24, 2011 at 12:11 AM, Akash Mukherjee <
>>> akash...@gmail.com>
>>> >>> wrote:
>>> >>>>
>>> >>>> kul man...wud appreciate if u cud post your question
>>> >>>>
>>> >>>> On Wed, Mar 23, 2011 at 11:28 PM, balaji a <peshwa.bal...@gmail.com
>>> >
>>> >>>> wrote:
>>> >>>>>
>>> >>>>> hi i got till the third round of technical interview out of the
>>> four
>>> >>>>> rounds and got eliminated in third round.....anyways thnx for ur
>>> support
>>> >>>>> dude :-)
>>> >>>>>
>>> >>>>> On Tue, Mar 22, 2011 at 12:51 PM, balaji a <
>>> peshwa.bal...@gmail.com>
>>> >>>>> wrote:
>>> >>>>>>
>>> >>>>>> Thnx :-) I am from SSN College of Engineering,Chennai....
>>> >>>>>> l
>>> >>>
>>> >>>
>>> >>>>>>
>>> >>>>>> On Tue, Mar 22, 2011 at 12:28 PM, Akash Mukherjee <
>>> akash...@gmail.com>
>>> >>>>>> wrote:
>>> >>>>>>>
>>> >>>>>>> u r welcome :), nd all the best for ur test.....btw, which clg??
>>> >>>>>>>
>>> >>>>>>> On Tue, Mar 22, 2011 at 11:45 AM, guru <peshwa.bal...@gmail.com>
>>> >>>>>>> wrote:
>>> >>>>>>>>
>>> >>>>>>>> Thank you very much for the info friend....And sure will give u
>>> a
>>> >>>>>>>> treat :-)
>>> >>>>>>>>
>>> >>>>>>>> On Mar 22, 11:02 am, Akash Mukherjee <akash...@gmail.com>
>>> wrote:
>>> >>>>>>>> > hey, dis is what i was told by a friend working @ amazon -
>>> >>>>>>>> >
>>> >>>>>>>> > Sometimes they do go to the level of the subject basics like
>>> OS or
>>> >>>>>>>> > DS but
>>> >>>>>>>> > you should be able to tackle these if you had studied well. No
>>> >>>>>>>> > separate prep
>>> >>>>>>>> > is needed.
>>> >>>>>>>> >
>>> >>>>>>>> > Few Favs DS & Algos ( i should get treat for revealing
>>> this.;)... )
>>> >>>>>>>> > 1) All Trees (Binary for sure)
>>> >>>>>>>> > 2) Graphs
>>> >>>>>>>> > 3) Sorting Algos
>>> >>>>>>>> > 4) Heaps
>>> >>>>>>>> > "Let us C" ... though clichéd gives a good insight. If you can
>>> find
>>> >>>>>>>> > time.
>>> >>>>>>>> >
>>> >>>>>>>> > can u tell a bit more about your profile?? fresher??
>>> >>>>>>>> >
>>> >>>>>>>> > On Tue, Mar 22, 2011 at 11:20 AM, guru <
>>> peshwa.bal...@gmail.com>
>>> >>>>>>>> > wrote:
>>> >>>>>>>> > > Hi geeks,
>>> >>>>>>>> > >    tomorrow i am having Amazon.com's Coding round followed
>>> by
>>> >>>>>>>> > > Interview...pls suggest some tips to help me out...
>>> >>>>>>>> >
>>> >>>>>>>> > > --
>>> >>>>>>>> > > You received this message because you are subscribed to the
>>> >>>>>>>> > > Google Groups
>>> >>>>>>>> > > "Algorithm Geeks" group.
>>> >>>>>>>> > > To post to this group, send email to
>>> algogeeks@googlegroups.com.
>>> >>>>>>>> > > To unsubscribe from this group, send email to
>>> >>>>>>>> > > algogeeks+unsubscr...@googlegroups.com.
>>> >>>>>>>> > > For more options, visit this group at
>>> >>>>>>>> > >http://groups.google.com/group/algogeeks?hl=en.
>>> >>>>>>>>
>>> >>>>>>>> --
>>> >>>>>>>> You received this message because you are subscribed to the
>>> Google
>>> >>>>>>>> Groups "Algorithm Geeks" group.
>>> >>>>>>>> To post to this group, send email to algogeeks@googlegroups.com
>>> .
>>> >>>>>>>> To unsubscribe from this group, send email to
>>> >>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>> >>>>>>>> For more options, visit this group at
>>> >>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>> >>>>>>>>
>>> >>>>>>>
>>> >>>>>>> --
>>> >>>>>>> You received this message because you are subscribed to the
>>> Google
>>> >>>>>>> Groups "Algorithm Geeks" group.
>>> >>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> >>>>>>> To unsubscribe from this group, send email to
>>> >>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>> >>>>>>> For more options, visit this group at
>>> >>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> --
>>> >>>>>> A.Balaji
>>> >>>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> --
>>> >>>>> A.Balaji
>>> >>>>>
>>> >>>>> --
>>> >>>>> 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.
>>> >>>
>>> >>>
>>> >>>
>>> >>> --
>>> >>> thezeitgeistmovement.com
>>> >>>
>>> >>> --
>>> >>> You received this message because you are subscribed to the Google
>>> Groups
>>> >>> "Algorithm Geeks" group.
>>> >>> To post to this group, send email to algogeeks@googlegroups.com.
>>> >>> To unsubscribe from this group, send email to
>>> >>> algogeeks+unsubscr...@googlegroups.com.
>>> >>> For more options, visit this group at
>>> >>> http://groups.google.com/group/algogeeks?hl=en.
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> A.Balaji
>>> >>
>>> >> --
>>> >> 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.
>>>
>>>
>>
>>
>> --
>> A.Balaji
>>
>>  --
>> 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.
>>
>
>
>
> --
> thezeitgeistmovement.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
A.Balaji

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

Reply via email to