Data Structures: The Stack

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/15

flashcard set

Earn XP

Description and Tags

Flashcards about Stacks

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

What is a Stack?

A stack is an Abstract Data Type where items are ordered by when they were added, and items are inserted/removed at one end.

2
New cards

What does LIFO stand for?

Last In, First Out

3
New cards

What does FILO stand for?

First In, Last Out

4
New cards

What is the function of 'push' in a stack?

Place an item on the stack.

5
New cards

What is the function of 'pop' in a stack?

Look at the item on top of the stack and remove it.

6
New cards

What is stack underflow?

Attempting to pop an item from an empty stack.

7
New cards

What is stack overflow?

Attempting to push an item onto a full stack.

8
New cards

What does Stack() do in the Stack ADT?

Creates a new stack.

9
New cards

What does Push(S, int x) do in the Stack ADT?

Adds integer x to stack S.

10
New cards

What does int Pop(S) do in the Stack ADT?

Removes and returns an integer from the top of stack S.

11
New cards

What does bool Empty(S) do in the Stack ADT?

Checks if stack S is empty, returns a boolean.

12
New cards

What are some applications of stacks?

Program execution via call stack, syntax and semantics of programming languages, evaluating expressions, parentheses matching, searching (Depth First).

13
New cards

What happens during a function call in relation to the system stack?

Push a new stack frame.

14
New cards

What happens when returning from a function call in the system stack?

Pop a stack frame.

15
New cards

How can stacks be used in matching braces?

Using stacks to determine if open and closed braces are correctly matched.

16
New cards

How can a stack be used to help a mouse find a path to cheese in a maze?

Using stacks to help the mouse find a path to the cheese.