Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#data structure you will be given the question the first picture , and you will be given the code or the resource the next four

#data structure

you will be given the question the first picture , and you will be given the code or the resource the next four pictures

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

2 Given the codes for "stack_02.cpp" and do the following tasks. a) Complete the code for printLIFO() function so that it will print all the stack item using LIFO and you must not using pop() function to do it. b) Complete the code for printFIFO() function so that it will print all the stack item using FIFO and you must not using pop() function to do it. The output must be exactly as follow: Push operation success item: Push operation success! iten: b Push operation success! item: FIFO printing abc LIFO printing cba MODULE & STACK 77 stack_01.cpp include Jinclude using namespace std; 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #define MAXSTACK 10 class Stack private: int top: char data (MAXSTACK) ; public: Stack(); bool is Full(); bool isEmpty(); void push (char); char pop(); // return the popped item ); // and Stack class declaration Stack::Stack() { top = -1; } bool Stack::isPull() return (top- (MAXSTACK - 1)); } bool Stack::isEmpty() return (top = (-1)); } void Stack::push(char item) if (!isFull()) top++; data[top] = item; cout else { cout #include using namespace std; #define MAXSTACK 10 class Stack private: int top: char data (MAXSTACK) ; public: Stack() top = -1; } bool isPull(); bool isEmpty(); void push(char); void printLIFO(); void printPIPO(); ) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 1 bool stack::isPull() return (top - (MAXSTACK - 1)); ) bool Stack::isimpty() return (top - (-1)); ) void Stack::push (char item) if (!isPull()) top++; data[top] - item; cout ) 44 ) 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 int main() Stack stack stack.push('a'); stack push('b'); stack.push('a'); cout include using namespace std; #define MAXSTACK 10 class Stack private: int top: char data [MAXSTACK]; public: Stack() { top = -1;) bool is Pull(); bool isEmpty(); void push (char): void pop(); void emptyStack(); } 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 bool Stack::isPull() return (top- (MAXSTACK - 1)); 1 bool Stack::isEmpty() 1 return (top == (-1)); 1 void stack::push(char item) if (!isFull()) top++; data[top] - item; cout

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_2

Step: 3

blur-text-image_3

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

9-3/2 Simplify without using a calculator.

Answered: 1 week ago