Starting from:
$30

$24

Homework 02 Solution

=========

Program 1

=========

The user should construct a new MinStack object within their Java program (no parameters are needed).

They are then free to use the following methods of the MinStack class:

void MinStack.push(int x): Push an integer x onto the stack

int MinStack.pop(): Remove and return the top element of the stack

int MinStack.top(): Return the top element of the stack

int MinStack.getMin(): Return the minimum element of the stack




=========

Program 2

=========

The user should input an expression of integers, arithmetic operators (+, -, *, /), and a single equality operator (<, , <=, =, =).

The program will then output whether the expression is true or false.

There should be a space between each integer and symbol. Input in any other format is invalid.




=========

Program 3

=========

The user should input an expression in postfix notation. Only single digit values may be used for input.

The program will then output the value of the input expression.

More products