472,127 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

implementation of stack

implementation of stack using arrays
Aug 14 '07 #1
6 2362
implementation of stack using linked lists
Aug 14 '07 #2
how to write a program using stack in python, i know the concept but not able to write a python code for it. could you please show me a sample program.
Aug 14 '07 #3
bvdet
2,851 Expert Mod 2GB
implementation of stack using arrays
A simple example:
Expand|Select|Wrap|Line Numbers
  1. >>> import array
  2. >>> a = array.array('i')
  3. >>> for i in range(10):
  4. ...     a.append(i)
  5. ...     
  6. >>> a
  7. array('i', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
  8. >>> for i in range(10):
  9. ...     print a.pop()
  10. ...     
  11. 9
  12. 8
  13. 7
  14. 6
  15. 5
  16. 4
  17. 3
  18. 2
  19. 1
  20.  
  21. >>> a
  22. array('i')
  23. >>> 
Aug 14 '07 #4
bartonc
6,596 Expert 4TB
implementation of stack using linked lists
This you your LAST WARNING, my friend.
Violation:
  1. Tripple posting
  2. Poorly formulated question
  3. No effort to show that you have done any work
It's all in the Posting Guidelines.
One more infraction will result in a one week ban on your account.
Thank you for your attention in this matter.
Aug 14 '07 #5
thank you very much this is really help full for me
Aug 15 '07 #6
thank you, i must follow those
Aug 15 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Chris Cranford | last post: by
4 posts views Thread by Chris Mabee | last post: by
3 posts views Thread by Thomas Ibbotson | last post: by
3 posts views Thread by Teis Draiby | last post: by
1 post views Thread by Phil Sandler | last post: by
10 posts views Thread by javuchi | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.