top of page

What is a stack?

  • Karla G
  • 28 mar 2015
  • 1 Min. de lectura

Here is a brief explanation of stack:

Plan B)

(Information gotten from http://interactivepython.org/)

The Stack Abstract Data Type

The stack abstract data type is defined by the following structure and operations. A stack is structured, as described above, as an ordered collection of items where items are added to and removed from the end called the “top.” Stacks are ordered LIFO. The stack operations are given below.

  • Stack() creates a new stack that is empty. It needs no parameters and returns an empty stack.

  • push(item) adds a new item to the top of the stack. It needs the item and returns nothing.

  • pop() removes the top item from the stack. It needs no parameters and returns the item. The stack is modified.

  • peek() returns the top item from the stack but does not remove it. It needs no parameters. The stack is not modified.

  • isEmpty() tests to see whether the stack is empty. It needs no parameters and returns a boolean value.

  • size() returns the number of items on the stack. It needs no parameters and returns an integer.

Stack examples:

A pile of boxes, where tou can only take the boxes from the above to get the ones at the bottom

In a pile of books you have to take the book at the top in order to take the next book.

References:

Brad Miller, David Ranum.. (2014). The Stack Abstract Data Type¶. 27 Maarzo del 2015, de http://interactivepython.org/ Sitio web: http://interactivepython.org/LpOMZ/courselib/static/pythonds/BasicDS/TheStackAbstractDataType.html

 
 
 

Comments


 THE ARTIFACT MANIFAST: 

 

This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are. Tip: Add your own image by double clicking the image and clicking Change Image.

 UPCOMING EVENTS: 

 

10/31/23:  Scandinavian Art Show

 

11/6/23:  Video Art Around The World

 

11/29/23:  Lecture: History of Art

 

12/1/23:  Installations 2023 Indie Film Festival

 FOLLOW THE ARTIFACT: 
  • Facebook B&W
  • Twitter B&W
  • Instagram B&W
 RECENT POSTS: 
 SEARCH BY TAGS: 

© 2023 by Karla Lugo. Proudly created with Wix.com

bottom of page