Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-17 Thread algogeek
This solution works perfectly :)

On Friday, June 15, 2012 10:59:22 AM UTC+5:30, Navin Kumar wrote:

 I corrected in function InsertAtBottom :In my code isntead of 
 (!IsEmptyStack) use IsEmptyStack

 On Fri, Jun 15, 2012 at 10:49 AM, Navin Kumar algorithm.i...@gmail.comwrote:

 @all:

 In my code isntead of (!IsEmptyStack) use IsEmptyStack

 Logic :

 First pop the all element and then start putting element at bottom in 
 reverse order i.e. the element which is fetched last is put at the bottom 
 and so on.

 ex: let our stack is: 1 2 3 4 (1 is at bottom).

 function Call is will be:

 Reverse(S) --Reverse(S)  --Reverse(S)   
 --Reverse(S)  --stack empty so return
 InsertAtBottom(4)   InsertAtBottom(3)InsertAtBottom(2)  
 InsertAtBottom(1)

 going back First 1 will be placed at bottom: stack content :1
 now 2 will be placed at bottom: stack content will be: 2 1
 now 3 will be placed at bottom: stack content will be: 3 2 1 
 now 4 will be placed at bottom: stack content will be:4 3 2 1 





 On Thu, Jun 14, 2012 at 2:46 PM, Nishant Pandey 
 nishant.bits.me...@gmail.com wrote:

 stack means inbuild stack we cant use any DS from our program explicitly.

 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant 
 use any auxillary DS than stack ? 


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 -- 
 Regards,
 Rahul Patil
  
 -- 
 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,

 Nishant Pandey |Specialist Tools Development  |  
 npan...@google.comgvib...@google.com | 
 +91-9911258345  


  -- 
 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 view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/pcs-ebKU_t8J.
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Ashish Goel
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread rahul patil
to store items in stack you will need some DS. Do they mean you cant use
any auxillary DS than stack ?


On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




-- 
Regards,
Rahul Patil

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Navin Kumar
void Reverse(struct Stack *S) {
int data;
if(IsEmptyStack(S)) return;
data=pop(s);
ReverseStack(S);
InsertAtBottom(S, data);
}

void InsertAtBottom(struct stack *S, int data)
{
   int temp;
   if(!IsEmptyStack(S)){
   push(S,data);
   return;
}
   temp=pop(S);
   InsertAtBottom(S,data);
push(S, temp);
}


On Thu, Jun 14, 2012 at 2:44 PM, rahul patil
rahul.deshmukhpa...@gmail.comwrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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



Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Sourabh Singh
@ Navin Kumar

Nice . Solution.
But
your  function also make a stack only. so you are using a stack[internal]
here.
but may be this one is allowed:-)

On Thu, Jun 14, 2012 at 5:23 AM, Navin Kumar algorithm.i...@gmail.comwrote:

 void Reverse(struct Stack *S) {
 int data;
 if(IsEmptyStack(S)) return;
 data=pop(s);
 ReverseStack(S);
 InsertAtBottom(S, data);
 }

 void InsertAtBottom(struct stack *S, int data)
 {
int temp;
if(!IsEmptyStack(S)){
push(S,data);
return;
 }
temp=pop(S);
InsertAtBottom(S,data);
 push(S, temp);

 }


 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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



Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Ashish Goel
Navin: copy pastes not encouraged till the logic is also clarified ;)

Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Thu, Jun 14, 2012 at 7:25 PM, Sourabh Singh singhsourab...@gmail.comwrote:

 @ Navin Kumar

 Nice . Solution.
 But
 your  function also make a stack only. so you are using a stack[internal]
 here.
 but may be this one is allowed:-)


 On Thu, Jun 14, 2012 at 5:23 AM, Navin Kumar algorithm.i...@gmail.comwrote:

 void Reverse(struct Stack *S) {
 int data;
 if(IsEmptyStack(S)) return;
 data=pop(s);
 ReverseStack(S);
 InsertAtBottom(S, data);
 }

 void InsertAtBottom(struct stack *S, int data)
 {
int temp;
if(!IsEmptyStack(S)){
push(S,data);
return;
 }
temp=pop(S);
InsertAtBottom(S,data);
 push(S, temp);

 }


 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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


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


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


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



Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Hassan Monfared
how can you pop from empty stack ?
  temp=pop(S); 

Regards,
Hassan
On Thu, Jun 14, 2012 at 8:25 PM, Ashish Goel ashg...@gmail.com wrote:

 Navin: copy pastes not encouraged till the logic is also clarified ;)

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Thu, Jun 14, 2012 at 7:25 PM, Sourabh Singh 
 singhsourab...@gmail.comwrote:

 @ Navin Kumar

 Nice . Solution.
 But
 your  function also make a stack only. so you are using a stack[internal]
 here.
 but may be this one is allowed:-)


 On Thu, Jun 14, 2012 at 5:23 AM, Navin Kumar algorithm.i...@gmail.comwrote:

 void Reverse(struct Stack *S) {
 int data;
 if(IsEmptyStack(S)) return;
 data=pop(s);
 ReverseStack(S);
 InsertAtBottom(S, data);
 }

 void InsertAtBottom(struct stack *S, int data)
 {
int temp;
if(!IsEmptyStack(S)){
push(S,data);
return;
 }
temp=pop(S);
InsertAtBottom(S,data);
 push(S, temp);

 }


 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant
 use any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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


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


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


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


-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Lomash Goyal
void pushreverse(int data)
{
int temp;
if(top==0)
{
push(data);
return;
}
else
temp=pop();
pushreverse(data);
push(temp);

}
int reversestack()
{
//static int arr[50];
 int top2=0;
int i;
if(top==0)
{ return top2;
}
 top2=pop();
reversestack();
pushreverse(top2);
 }


On Thu, Jun 14, 2012 at 2:44 PM, rahul patil
rahul.deshmukhpa...@gmail.comwrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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




-- 
Regards

Lomash Goyal
*
*

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Karthikeyan V.B
Hi all,

Generate combinations (taken k out of n) of a given string

Eg: Input : abcd
Output:
abc
acd
abd
bcd

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Nishant Pandey
the steps would be like this :
if i say stack is like this 1,2,3,4 then
1) pop each and every item from the stack till stack is empty
the nodes will be ther in function call stack stil  not pushed

2) now now take elements from function call stack like 4 and push it
3) when 3 comes next time first pop 4 and then push 3 again
4) repeat the step 3 again till the function call stack in not empty .

and uir done .

On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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

Nishant Pandey |Specialist Tools Development  |
npan...@google.comgvib...@google.com |
+91-9911258345

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Nishant Pandey
stack means inbuild stack we cant use any DS from our program explicitly.

On Thu, Jun 14, 2012 at 2:44 PM, rahul patil
rahul.deshmukhpa...@gmail.comwrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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

Nishant Pandey |Specialist Tools Development  |
npan...@google.comgvib...@google.com |
+91-9911258345

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Nishant Pandey
i think i already explained the logic initially :)

On Thu, Jun 14, 2012 at 9:30 PM, Hassan Monfared hmonfa...@gmail.comwrote:

 how can you pop from empty stack ?
   temp=pop(S); 

 Regards,
 Hassan

 On Thu, Jun 14, 2012 at 8:25 PM, Ashish Goel ashg...@gmail.com wrote:

 Navin: copy pastes not encouraged till the logic is also clarified ;)

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Thu, Jun 14, 2012 at 7:25 PM, Sourabh Singh 
 singhsourab...@gmail.comwrote:

 @ Navin Kumar

 Nice . Solution.
 But
 your  function also make a stack only. so you are using a
 stack[internal] here.
 but may be this one is allowed:-)


 On Thu, Jun 14, 2012 at 5:23 AM, Navin Kumar 
 algorithm.i...@gmail.comwrote:

 void Reverse(struct Stack *S) {
 int data;
 if(IsEmptyStack(S)) return;
 data=pop(s);
 ReverseStack(S);
 InsertAtBottom(S, data);
 }

 void InsertAtBottom(struct stack *S, int data)
 {
int temp;
if(!IsEmptyStack(S)){
push(S,data);
return;
 }
temp=pop(S);
InsertAtBottom(S,data);
 push(S, temp);

 }


 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant
 use any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.comwrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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


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


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


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


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

Nishant Pandey |Specialist Tools Development  |
npan...@google.comgvib...@google.com |
+91-9911258345

-- 
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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Navin Kumar
@all:

In my code isntead of (!IsEmptyStack) use IsEmptyStack

Logic :

First pop the all element and then start putting element at bottom in
reverse order i.e. the element which is fetched last is put at the bottom
and so on.

ex: let our stack is: 1 2 3 4 (1 is at bottom).

function Call is will be:

Reverse(S) --Reverse(S)  --Reverse(S)
--Reverse(S)  --stack empty so return
InsertAtBottom(4)   InsertAtBottom(3)InsertAtBottom(2)
InsertAtBottom(1)

going back First 1 will be placed at bottom: stack content :1
now 2 will be placed at bottom: stack content will be: 2 1
now 3 will be placed at bottom: stack content will be: 3 2 1
now 4 will be placed at bottom: stack content will be:4 3 2 1





On Thu, Jun 14, 2012 at 2:46 PM, Nishant Pandey 
nishant.bits.me...@gmail.com wrote:

 stack means inbuild stack we cant use any DS from our program explicitly.

 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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

 Nishant Pandey |Specialist Tools Development  |  
 npan...@google.comgvib...@google.com |
 +91-9911258345


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



Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Navin Kumar
I corrected in function InsertAtBottom :In my code isntead of
(!IsEmptyStack) use IsEmptyStack

On Fri, Jun 15, 2012 at 10:49 AM, Navin Kumar algorithm.i...@gmail.comwrote:

 @all:

 In my code isntead of (!IsEmptyStack) use IsEmptyStack

 Logic :

 First pop the all element and then start putting element at bottom in
 reverse order i.e. the element which is fetched last is put at the bottom
 and so on.

 ex: let our stack is: 1 2 3 4 (1 is at bottom).

 function Call is will be:

 Reverse(S) --Reverse(S)  --Reverse(S)
 --Reverse(S)  --stack empty so return
 InsertAtBottom(4)   InsertAtBottom(3)InsertAtBottom(2)
 InsertAtBottom(1)

 going back First 1 will be placed at bottom: stack content :1
 now 2 will be placed at bottom: stack content will be: 2 1
 now 3 will be placed at bottom: stack content will be: 3 2 1
 now 4 will be placed at bottom: stack content will be:4 3 2 1





 On Thu, Jun 14, 2012 at 2:46 PM, Nishant Pandey 
 nishant.bits.me...@gmail.com wrote:

 stack means inbuild stack we cant use any DS from our program explicitly.

 On Thu, Jun 14, 2012 at 2:44 PM, rahul patil 
 rahul.deshmukhpa...@gmail.com wrote:

 to store items in stack you will need some DS. Do they mean you cant use
 any auxillary DS than stack ?


 On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote:


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

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




 --
 Regards,
 Rahul Patil

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

 Nishant Pandey |Specialist Tools Development  |  
 npan...@google.comgvib...@google.com |
 +91-9911258345


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