Lecture Notes: Infix/Reverse Polish Notation, Stacks, and Set ADT (Greek University Course)

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

1/36

flashcard set

Earn XP

Description and Tags

A comprehensive set of vocabulary-style flashcards covering infix, postfix, and Reverse Polish Notation (RPN); stack concepts and operations; and Set Abstract Data Type (ADT) concepts and implementations.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

37 Terms

1
New cards

Infix notation

A form where operators are written between operands (e.g., A * B); parentheses are often used to specify the intended order of operations.

2
New cards

Unary operator

An operator that acts on a single operand (e.g., negation or plus/minus in front of a number).

3
New cards

Binary operator

An operator that acts on two operands (e.g., +, −, ×, ÷).

4
New cards

Operand

An element on which an operator acts in an expression.

5
New cards

Operator

A symbol that denotes an operation to perform on operands (e.g., +, -, *, /).

6
New cards

Postfix notation

Also known as postfix or Reverse Polish Notation; operators come after their operands (e.g., A B *).

7
New cards

Reverse Polish Notation (RPN)

A postfix expression format used for easy evaluation with a stack; no parentheses are required.

8
New cards

Infix to postfix conversion

A process (often via a stack) to convert an infix expression to a postfix expression, considering operator precedence and associativity.

9
New cards

Example of an RPN expression

An expression like (A × B) − (C + D) can be written in RPN as A B × C D + −.

10
New cards

Stack (LIFO)

A last-in, first-out data structure used to hold operands or operators during RPN evaluation or infix-to-postfix conversion.

11
New cards

Push

Operation that inserts a new element onto the top of a stack.

12
New cards

Pop

Operation that removes and returns the top element from a stack.

13
New cards

Top

The index or pointer indicating the position of the current top element of a stack.

14
New cards

CreateStack

Initialize an empty stack (e.g., set Top to -1 in an array-based implementation).

15
New cards

EmptyStack

A check to determine if a stack has no elements (usually Top == -1).

16
New cards

FullStack

A check to determine if a stack has reached its capacity (based on a predefined limit).

17
New cards

StackADT

An abstract data type interface for stacks, defining operations like CreateStack, Push, Pop, and EmptyStack.

18
New cards

Stack memory representation with array

Stacks can be implemented using an array with a Top index to track the current top element.

19
New cards

Algorithmic use of stack for RPN evaluation

To evaluate an RPN expression, push operands onto the stack and, when an operator is encountered, pop the required number of operands, apply the operator, and push the result back.

20
New cards

Set

A non-ordered collection of distinct elements; membership is expressed as x ∈ A.

21
New cards

Universal set

The set that contains all objects being considered for a problem; e.g., the digits 0–9.

22
New cards

Membership

Relation indicating whether an element belongs to a set (x ∈ A) or does not belong (x ∉ A).

23
New cards

Union of sets

The set of elements that are in A or in B or in both (A ∪ B).

24
New cards

Intersection of sets

The set of elements that are in both A and B (A ∩ B).

25
New cards

Difference of sets

The set of elements that are in the first set but not in the second (A − B).

26
New cards

Empty set

A set with no elements; denoted Ø or {}.

27
New cards

Subset

A set S1 is a subset of S2 if every element of S1 is also an element of S2 (S1 ⊆ S2).

28
New cards

Equality of sets

Two sets are equal if they contain exactly the same elements.

29
New cards

Set ADT implemented with an array (in C)

An array-based representation where a boolean array indicates membership of each element of the universal set; used to implement operations like insert, delete, union, intersection, and difference.

30
New cards

Membership test (in a Set ADT)

Function that checks if a given element is in a set by testing its corresponding boolean flag in the membership array.

31
New cards

Insert into a set

Add an element to a set by marking its membership flag as true.

32
New cards

Delete from a set

Remove an element from a set by marking its membership flag as false.

33
New cards

Union operation in a Set ADT

Create a new set whose membership flags are true wherever either input set has true membership.

34
New cards

Intersection operation in a Set ADT

Create a new set whose membership flags are true only where both input sets have true membership.

35
New cards

Difference operation in a Set ADT

Create a new set with elements that are in the first set but not in the second.

36
New cards

Subsetting test

Check if every element of one set is also an element of another set.

37
New cards

Equality test in Set ADT

Check whether two sets have identical memberships for all elements in the universal set.