473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

implementation of stack

implementation of stack using arrays
Aug 14 '07 #1
6 2528
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

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

Similar topics

1
by: Chris Cranford | last post by:
I am in the process of implementing a stack machine virtual environment where each entry on the stack is a 32-bit value which then can reference to any memory pointer, numeric value, or alike. ...
4
by: Chris Mabee | last post by:
Hello all, and Merry Christmas, I'm having a problem understanding an example of an array based implementation of a stack in a textbook of mine. The code in question is written below. The syntax...
3
by: Thomas Ibbotson | last post by:
I've been going through a tutorial on C++ and I've come across what I regard as some strange behaviour. As part of the tutorial on classes a simple stack is implemented with functions push() and...
20
by: Sushil | last post by:
Hi gurus I was reading FAQ "alloca cannot be written portably, and is difficult to implement on machines without a conventional stack." I understand that the standard does not mandate...
4
by: Dave Bailey | last post by:
I have an application installed on a web server. When forst intalled it worked fine. The administrator rebooted the server and then when accessing the app the folowing error appears: CryptoAPI...
3
by: Teis Draiby | last post by:
I'm looking for some information (books, articles, tutorials) on how to implement a multiple undo/redo framework. I'm a beginner in this so I prefer information specifically targeting C# with code...
1
by: Phil Sandler | last post by:
Hello all, Thanks in advance for any help with this. I am trying to get sample code to run from Michael Russell's excellent article on removing whitespace:...
10
by: javuchi | last post by:
I just want to share some code with you, and have some comments and improvements if you want. This header file allocates and add and delete items of any kind of data from a very fast array: ...
12
by: svkers | last post by:
Hi all, I have a question concerning the implementation of an interface between two layers of a network stack (see extract of the subsequent stack). Furthermore I am thankful for some hints how to...
0
by: tabassumpatil | last post by:
Please send the c code for: 1.STACK OPERATIONS : Transfer the names stored in stack s1 to stack s2 and print the contents of stack s2. 2.QUEUE OPERATIONS : Write a program to implement...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.