1 / 6

STACKS

STACKS. Pgs. 232-235 Presented by Haylee Glad. STACKS. Restricted linear list in which all additions and deletions are made at one end, called the top Last In, First Out (LIFO) Examples: dishes, coins, or books. PUSH, POP AND EMPTY. PUSH Adds items on the top of the stack

Download Presentation

STACKS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. STACKS Pgs. 232-235 Presented by Haylee Glad

  2. STACKS • Restricted linear list in which all additions and deletions are made at one end, called the top • Last In, First Out (LIFO) • Examples: dishes, coins, or books

  3. PUSH, POP AND EMPTY PUSH • Adds items on the top of the stack • If an item is pushed and there is no room it results in an overflow

  4. PUSH, POP AND EMPTY POP • Removes items from the top of a stack and returns it to the user • If an item is popped when the stack is empty it results in an underflow

  5. PUSH, POP AND EMPTY EMPTY • The response is either true or false • Example: push (S, 10) push (S, 12) push (S, 8) if not empty (S), then pop (8) push (S, 2)

  6. STACK APPLICATIONS • Reversing Data info recorded backwards (ex. input: 1234 output: 4321) • Parsing breaks data into individual pieces for further processing (ex. Key words) • Postponement postpones use of data until a later point • Backtracking goes back to previous data

More Related