SYSC 2006 Lecture Notes - Lecture 21: Linked List, C Dynamic Memory Allocation, In C

85 views2 pages

Document Summary

A stack is a collection in which elements are maintained in the order in which they are added. They differ from queues as stacks are lifo collections (last - in, first - out) Determine the length (size) of a stack (i. e. , # of elements) Print the contents of a stack - useful for testing/ debugging. Iterate over the contents of a stack - useful for testing/ debugging. In general, a stack should not provide support to the following operations as they contradict the stack"s. Lifo protocol search a stack for a specific element remove a specific element from a stack retrieve/ replace/ insert/ delete/ an element at a specific position in the stack. In c, we can use an array or singly linked list as a data structure that permits efficient implementation of a stack. In python, a stack is implemented using the list class. In java, a stack is implemented using the arraylist class.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents