by using c++ & datastructure  1- Implement a class template Node that has the following declaration:template class Node { T info; Node* next; public: Node(T, Node* n=0); Node* getNext(); void setNext(Node* ); T getInfo (); void setInfo (T); }; 2- Create a class template SLL, which is a single linked list with the following declaration: template class SLL { Node *head, *tail; public: SLL(){head = tail = 0;} void addtoHead(T); void addtoTail(T); T removeFromHead(); T removeFromTail(); T getValueAtHead();//a function that returns the value at head without deleting it bool isEmpty(); void clear(); friend ostream& operator<<(ostream&, const SLL&); }; 3- Implement the class Template StackSLL which uses the linked list you created in part (2). The class should have the functions: push , pop , top, isEmpty, and clear. Each of the functions should use the available member functions of SLL. 4- Implement the class Template QueueSLL which uses the linked list you created in part (2). The class should have the functions: enqueue , dequeue , front, isEmpty, and clear. Each of the functions should use the available member functions of SLL. 5- Implement a function bool chkBalanced(string) that uses a stack to check if the brackets entered within an expression are balanced. The brackets handled should include { } ,< > , [ ], ( ). Example expressions: { ( ( x + y ) * 63 – a [ i+2 ] ) { } }. Output: Balanced Example expressions: { ( x + y ) * 63 – a [ i+2 ] ) { } }. Output: Imbalanced 6- Implement a function string convertToBinary(int) that uses a stack to convert a decimal number to a binary number returned as a bit string. Example input: 218. Output: 11011010 7- Implement a function string convertInfixToPostfix(string) that uses a stack to convert an infix mathematical expression to a postfix notation. Assume that only 1-digit integers are used within the expression. Example input: 6 * 3 + 8 / 2 . Output: 6 3 * 8 2 / + The algorithm to do such conversion is in Weiss book, Chapter 3: Infix to Postfix Conversion, page 108. 8- Implement a function int evaluatePostfix(string) that uses a stack to evaluate a postfix expression and return the value as an integer. Assume that only 1- digit integers are used within the expression. Example input: 6 3 * 8 2 / + . Output: 22

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

by using c++ & datastructure 

1- Implement a class template Node that has the following declaration:template class Node { T info; Node* next; public: Node(T, Node* n=0); Node* getNext(); void setNext(Node* ); T getInfo (); void setInfo (T); };

2- Create a class template SLL, which is a single linked list with the following declaration: template class SLL { Node *head, *tail; public: SLL(){head = tail = 0;} void addtoHead(T); void addtoTail(T); T removeFromHead(); T removeFromTail(); T getValueAtHead();//a function that returns the value at head without deleting it bool isEmpty(); void clear(); friend ostream& operator<<(ostream&, const SLL&); };

3- Implement the class Template StackSLL which uses the linked list you created in part (2). The class should have the functions: push , pop , top, isEmpty, and clear. Each of the functions should use the available member functions of SLL.

4- Implement the class Template QueueSLL which uses the linked list you created in part (2). The class should have the functions: enqueue , dequeue , front, isEmpty, and clear. Each of the functions should use the available member functions of SLL.

5- Implement a function bool chkBalanced(string) that uses a stack to check if the brackets entered within an expression are balanced. The brackets handled should include { } ,< > , [ ], ( ). Example expressions: { ( ( x + y ) * 63 – a [ i+2 ] ) { } }. Output: Balanced Example expressions: { ( x + y ) * 63 – a [ i+2 ] ) { } }. Output: Imbalanced

6- Implement a function string convertToBinary(int) that uses a stack to convert a decimal number to a binary number returned as a bit string. Example input: 218. Output: 11011010

7- Implement a function string convertInfixToPostfix(string) that uses a stack to convert an infix mathematical expression to a postfix notation. Assume that only 1-digit integers are used within the expression. Example input: 6 * 3 + 8 / 2 . Output: 6 3 * 8 2 / + The algorithm to do such conversion is in Weiss book, Chapter 3: Infix to Postfix Conversion, page 108.

8- Implement a function int evaluatePostfix(string) that uses a stack to evaluate a postfix expression and return the value as an integer. Assume that only 1- digit integers are used within the expression. Example input: 6 3 * 8 2 / + . Output: 22

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY