Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey, it is my assignment; I need someone helps to complete this code by C#. thank you Complete the attached MyLinkedStack.cs. (50 points) Part1. Complete

Hey,

it is my assignment; I need someone helps to complete this code by C#. thank you

Complete the attached MyLinkedStack.cs. (50 points)

Part1. Complete the MyListStack. There are four methods to be completed: Push(), Pop(), IsEmpty() and Size() .

Part2. Complete a method to evaluate postfix expressions using MyListStack. (Don't know what is postfix! Refer to my slides on Stacks in Course Documents.)

------------------------------------------------------------------------

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace StackExperiment { //we use TestStackProgram to test our program class TestStackProgram { static void Main(string[] args) { MyListStack myStack = new MyListStack();

string testString = "78+2*5-";

int result = EvaluatePostFix(testString, myStack);

Console.WriteLine("The expression produces: "+ result);

Console.ReadKey();

}

//Part 2: Complete this method to evaluate Postfix Expressions using MyListStack static int EvaluatePostFix(string testString, MyListStack stack) {

}

}

//definition of each Node of Stack public class Node { public int data; public Node next;

public Node(int item) { data = item; next = null; } }

//Part 1: Complete class MyListStack public class MyListStack { //top element private Node top = null; // number of elements stored private int numberOfNodes = 0;

//indicates whether no elements are stored public bool IsEmpty() {

}

//returns the number of elements stored public int Size() {

}

//inserts an element public void Push(int item) {

}

//removes and returns the last inserted element public int Pop() {

}

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions