Question
CAN SOMEONE PLEASE HELP ME OUT WITH THE FOLLOWING PROBLEMS, THEY ARE ALL FOR C++ CODE: Problem 1: Implement a linked list based Stack class
CAN SOMEONE PLEASE HELP ME OUT WITH THE FOLLOWING PROBLEMS, THEY ARE ALL FOR C++ CODE:
Problem 1: Implement a linked list based Stack class using the following definition.
class Stack
{
private:
class Node
{
public:
//put the pointer and data in here
};
Node *Top;
public:
//setup initial conditions
Stack();
//delete all dynamic memory, etc.
~Stack();
//add x to top of the stack
void Push(char x);
//remove the top item from the stack and return it
char Pop();
//return true if the stack is empty, otherwise return false
bool empty();
};
Problem 2: Write a program that takes any string from the user and runs the palindrome test on it. We discussed this algorithm in class. This should use two stacks created using the class from Problem 1. The basic process is:
1. Push the string onto one stack
2. Pop half the stack and push it onto the second stack
3. Check the parity issue
4. Pop both stacks simultaneously and compare
5. Output results
Problem 3: Write a program that takes in a long integer in the range [0, , 1,000,000,000] and outputs its binary equivalent using a function with an iterative loop and a stack. If the number is too large it should tell the user. You can use the stack STL template class for this problem.
Problem 4: Similar to Lab 7, write a program that takes in a decimal number, a new base, and a digit and then returns the number of matching digits in the number in the new base. For instance 232223 has 4 2's in base 10, 15 has 4 1's in base 2. Assume that 10 is the largest base. This must be implemented iteratively with a stack. You can use the stack STL template class for this problem
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started