Question: Question I. ( 4 0 points ) Consider a variation of the singly linked list that always has a dummy node at the beginning of

Question I. (40 points) Consider a variation of the singly linked list that always has a "dummy node" at the
beginning of the list with no data (i.e. the info field is always null). An empty list contains the dummy node
only. A list with n elements has n+1 nodes, the first node is the dummy node.
a. Rewrite the constructor for SinglyLinkedList so that it creates an "empty" list consisting of the one
dummy node.
b. Rewrite the methods addToHead(), addToTail(), deleteFromHead(), deleteFromTail(), search() and
isEmpty().
c. Implement a new method reverse() that reverses the nodes on the singly linked list.
Question II (40 points): Using the provided Stack class implementation in the lab, you will create a parser to
identify a secret message hidden within another string. These secret messages are enclosed in curly braces
within otherwise readable text (e.g., "This sentence contains a {terces} message"). The secret messages are just
words in reverse, which we can use a stack to flip back into a readable format. Write a method decode() that
prints all secret messages between '' and '}' characters. Below are some sample outputs.
Question I. ( 4 0 points ) Consider a variation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!