Data Structure and Algorithms

494 views

Published on

Data Structure and Algorithms Hom

Published in: Technology, Self Improvement
  • Be the first to comment

Data Structure and Algorithms

  1. 1. Mahesh Kodituwakku
  2. 2. (A=3,B=4,C=5) (A+B)*C
  3. 3. First step let's solve the brackets (A+B)*C (AB+)*C Then we need to slove Mutipication AB+*C AB+C* If A=3,B=4,C=5 then we have to write above equitation as 34+5* 
  4. 4.   Step 1 is Push(3) and Push (4) 4 3
  5. 5.   Step 2 is Pop(4) and Pop (3)and use expression + 3 4 3 + 4 Expression + 3+4=7
  6. 6.   Step 3 is Push(7) (Answer of 3+4=7) 7
  7. 7.   Step 4 is Then pop(5)to the stack 5 7
  8. 8.   Step 5 is Pop(5) and Pop (7)and use expression * 7 5 7 * 5 Expression * 7*5=35
  9. 9.   Step 6 is Push(35) to the stack 35 Answer is 35

×