Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Write a program that reads a list of words from the Words.txt file (shown below), and stores it into a singly linked list, and

C++ Write a program that reads a list of words from the Words.txt file (shown below), and stores it into a singly linked list, and prints the words from the singly linked list to the console in reverse order. Implement the program, as outlined below in the pseudocode, using singly linked list interface to store the data read from Words.txt. ********Demonstrate that the list of words does print in reverse using the 'prev' node (rather than the 'next' node).**********

(Pseudocode, 3 classes) class ListInterface  // Sees whether this list is empty. // return True if the list is empty, or false if not. boolean isEmpty() // Adds a new entry to the list. // post If successful, newEntry is stored in the list and // the count of items in the list has increased by 1. // param newEntry The object to be added as a new entry. // return True if addition was successful, or false if not. boolean add(T newEntry) // Removes one occurrence of a given entry from this list, if possible. // post If successful, anEntry has been removed from the list and the count of // items in the list has decreased by 1. // param anEntry The entry to be removed. // return True if removal was successful, or false if not. boolean remove(T anEntry) // Removes all entries from this list. // post List contains no items, and the count of items is 0. void clear() // Counts the number of times a given entry appears in list. // param anEntry The entry to be counted. // return The number of times anEntry appears in the list. int getFrequencyOf(T anEntry) // Tests whether this list contains a given entry. // param anEntry The entry to locate. // return True if list contains anEntry, or false otherwise. bool contains(T anEntry) class Node T item // A data item Node prev // Important! previous node! // ... class List : ListInterface Node head; int itemCount; // ... 

(Words.txt) is as follows, this code should work even if file is changed to many more words:

when

what

there

been

one

could

very

an

who

them

weekend

we

now

more

out

do

are

up

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

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago