@sanjay:
yes.. the optimization is nice.. may be even better if we have the array
split into 2 array's half each...
and yes.. the qn is already answered.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web vis
It will be good optimisation to keep the elements in second stack
itself after first random access. Maintaining count of elements in
both stack and pop from second stack can result in less number of push
and pop operation for subsequent random access.
On Sat, Jul 23, 2011 at 3:52 PM, ross wrote:
thanks all.:)
On Sun, Jul 24, 2011 at 1:05 AM, Gaurav Popli wrote:
> it is given in tanenbaum
>
> On Sat, Jul 23, 2011 at 9:49 PM, Pankaj wrote:
> > Can you please tell us from where we can find such questions?
> >
> > On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta >
> > wrote:
> >>
> >> Nic
it is given in tanenbaum
On Sat, Jul 23, 2011 at 9:49 PM, Pankaj wrote:
> Can you please tell us from where we can find such questions?
>
> On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta
> wrote:
>>
>> Nice question Kamakshi. The person above has given almost a perfect
>> answer.
>> For examp
Can you please tell us from where we can find such questions?
On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta wrote:
> Nice question Kamakshi. The person above has given almost a perfect answer.
>
> For example i=3, we will pop the elements one by one from the top of the
> 1st stack and pushed to t
Nice question Kamakshi. The person above has given almost a perfect answer.
For example i=3, we will pop the elements one by one from the top of the 1st
stack and pushed to the 2nd stack until the value (top - i) is reached.
On Sat, Jul 23, 2011 at 3:52 PM, ross wrote:
> Well. the idea of an ar
Well. the idea of an array is - given an integer 'i', you should
support RANDOM ACCESS to the ith element in the 1d array.
Since, we have two stacks, if you want to access an ith element ( say,
i = 5 ),pop all the top 4 elements from the 1st stack and push it to
the second stack.
Now, access the 5t