By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,985 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,985 IT Pros & Developers. It's quick & easy.

implementation of stack

P: 9
implementation of stack using arrays
Aug 14 '07 #1
Share this Question
Share on Google+
6 Replies


P: 9
implementation of stack using linked lists
Aug 14 '07 #2

P: 9
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
Expert Mod 2.5K+
P: 2,851
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
Expert 5K+
P: 6,596
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

P: 9
thank you very much this is really help full for me
Aug 15 '07 #6

P: 9
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.