Evaluate Postfix Expression using Stack

  Рет қаралды 16,397

nETSETOS

nETSETOS

Күн бұрын

Пікірлер: 14
@girishkumargoyal5480
@girishkumargoyal5480 4 жыл бұрын
videos are great for understand algorithms......
@nETSETOStECH
@nETSETOStECH 4 жыл бұрын
Thank you friend. Share with your friends also.😀
@somalasresthasomala8974
@somalasresthasomala8974 3 жыл бұрын
GREAT VIDEO, truly appreciate your efforts!
@meitarG
@meitarG 7 ай бұрын
And what will happen if we don't have 2 numbers at the beginning of the array? or if we divide by zero? [5,*,2,/,0,*,+,3,-]
@tejoram2265
@tejoram2265 3 жыл бұрын
thanks you great video
@husseindarwish8731
@husseindarwish8731 3 жыл бұрын
Thank you for video My question How to do simulation of expression evaluation using stack?
@ramilashraf2669
@ramilashraf2669 3 жыл бұрын
for this [5,1,2,/,4,*,+,3,-] the output should be 4 but its showing 2
@kishorereddy9453
@kishorereddy9453 11 ай бұрын
Return value should be stack[0] not stack [-1]
@KrishnaManohar8021
@KrishnaManohar8021 4 жыл бұрын
Please build the program, then we easily understand flow of the program.
@nETSETOStECH
@nETSETOStECH 4 жыл бұрын
Python program is also attached in Github github.com/netsetos/python_code/blob/master/eval_expression.py
@sarveshrai4286
@sarveshrai4286 4 жыл бұрын
if exprn is=['2','3','*','+','4'] then what will happen
@shazznomani1368
@shazznomani1368 4 жыл бұрын
I think this isn't postfix expression, it should be [2, 3, *, 4, +]
@adityajadhav879
@adityajadhav879 10 ай бұрын
def eval_expression(arr): stack = [] operator = ["+", "-", "*", "/", "%"] for item in arr: if item not in operator: stack.append(int(item)) # Convert the operand to an integer else: first = int(stack.pop()) sec = int(stack.pop()) if item == "+": stack.append(sec + first) elif item == "-": stack.append(sec - first) elif item == "*": stack.append(sec * first) elif item == "/": stack.append(sec / first) elif item == "%": stack.append(sec % first) return stack[-1] A = ["7", "5", "3", "-", "2", "*", "+"] print(eval_expression(A)) "CORRECT CODE "
@黑人問號-z3i
@黑人問號-z3i 3 жыл бұрын
....it's must have a troblem 14 2 - 3 / 7 11 * + ↑it can't run...
BALANCED PARENTHESIS - STACK | DATA STRUCTURES
16:03
nETSETOS
Рет қаралды 11 М.
This Game Is Wild...
00:19
MrBeast
Рет қаралды 157 МЛН
Towers of Hanoi: A Complete Recursive Visualization
21:13
Reducible
Рет қаралды 491 М.
Application of Stacks (Infix to Postfix) - Part 8
22:47
Neso Academy
Рет қаралды 48 М.
How to STUDY so FAST it feels like CHEATING
8:03
The Angry Explainer
Рет қаралды 1,8 МЛН
Stacks and Queues (Python) - Data Structures and Algorithms
14:10
Infix to Postfix | Expression evaluation | C-Programming | Gate Applied Course
19:20
3.6 Infix to Postfix using Stack | Data Structures Tutorials
20:10
Jenny's Lectures CS IT
Рет қаралды 1,8 МЛН
TRAPPING RAIN WATER | python code
15:28
nETSETOS
Рет қаралды 14 М.
Application of Stacks (Infix to Postfix) - Part 6
18:49
Neso Academy
Рет қаралды 156 М.
This Game Is Wild...
00:19
MrBeast
Рет қаралды 157 МЛН