if two stacks then possible
otherwise i dont think so
On Mon, Apr 12, 2010 at 11:39 PM, Dheeraj Jain wrote:
> Here is code and explanation http://geeksforgeeks.org/?p=5009
>
>
> On Sat, Apr 10, 2010 at 10:18 PM, Rohit Saraf > wrote:
>
>> hmm... that can always be done !
>>
>> ---
Here is code and explanation http://geeksforgeeks.org/?p=5009
On Sat, Apr 10, 2010 at 10:18 PM, Rohit Saraf
wrote:
> hmm... that can always be done !
>
> --
> Rohit Saraf
> Second Year Undergraduate,
> Dept. of Computer Science and Engineering
> IIT
hmm... that can always be done !
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
On Wed, Mar 24, 2010 at 6:24 PM, Dave wrote:
> Please post your results. I'd lik
Please post your results. I'd like to study your algorithm.
On Mar 23, 11:15 pm, chitta koushik
wrote:
> yeah i understand that . still wanted to attempt writing a recursive
> reverse() stack operation.
>
> On Wed, Mar 24, 2010 at 9:21 AM, Rohit Saraf
> wrote:
>
>
>
> > Even when you are wri
yeah i understand that . still wanted to attempt writing a recursive
reverse() stack operation.
On Wed, Mar 24, 2010 at 9:21 AM, Rohit Saraf wrote:
> Even when you are writing a recursive function.. you are not using one
> stack.
> One stack is yours. Other used for recursion.
>
> Making queu
Even when you are writing a recursive function.. you are not using one
stack.
One stack is yours. Other used for recursion.
Making queue from a single stack <=> Making turing machine from CFG.
-Rohit
On Wed, Mar 24, 2010 at 9:18 AM, chitta koushik
wrote:
> Can we implement it using a single s
Can we implement it using a single stack by writing a recursive reverse
stack operation ?
On Tue, Mar 23, 2010 at 10:18 AM, Sundeep Singh wrote:
> Thanks Dave, I didn't think about this... definitely better!
>
> Sundeep.
>
>
> On Mon, Mar 22, 2010 at 9:08 PM, Dave wrote:
>
>> Better still.
>>
Thanks Dave, I didn't think about this... definitely better!
Sundeep.
On Mon, Mar 22, 2010 at 9:08 PM, Dave wrote:
> Better still.
> To enqueue: push onto stack A.
> For dequeuing: If stack B is empty, pop all items from stack A and
> push onto stack B. Then pop stack B.
> There is no need to p
Better still.
To enqueue: push onto stack A.
For dequeuing: If stack B is empty, pop all items from stack A and
push onto stack B. Then pop stack B.
There is no need to push remaining items back to stack A.
As every item passes through the queue, it is pushed onto stack A,
then popped from stack A