Question: USE REQS IN THE LAST PICUTRE FOR PROGRAM Description You are required to write an interactive C program that prompts the user for commands, accepts

 USE REQS IN THE LAST PICUTRE FOR PROGRAM Description You are

USE REQS IN THE LAST PICUTRE FOR PROGRAM

required to write an interactive C program that prompts the user for

commands, accepts commands from the keyboard (stdin and executes those commands. When

a command requires output, it must be written to stdout, The program

must continue to accept and process commands until the user types the Description You are required to write an interactive C program that prompts the user for commands, accepts commands from the keyboard (stdin and executes those commands. When a command requires output, it must be written to stdout, The program must continue to accept and process commands until the user types the end command. The program deals with linked lists. Each node of such a list contains a string of length at most 10, a positive integer (i.c., an integer value 1) and a pointer to the next node of the list. For any node, the string and the integer stored in that node will be referred to as the symbol and count for that node respectively. At all times, the list must satisfy the following two important properties. 1. The symbols appearing in the list are all distinct; that is, no two nodes have the same symbol. 2. When the list is scanned from left to right, the counts must be in non-increasing order. An example of such a linked list is shown below. Initially, we have an empty list. Some commands require your program to modify the list while others involve traversing the list to gather and print information about the list. The commands and their interpretations are as follows Vou should bear in mind that different parts of a command are separated by one or more spaces.) A. Insert Command: The syntax for this command is as follows: ins str Here, ins represents the name of the command and sta represents a string. The interpretation of this command is as follows. (a) If the list contains a node whose symbol is identical to the string specified in the command, then the count stored in the node must be incremented by 1. After this increment, if necessary, the node must be moved to an appropriate position in the list to ensure that the counts are in non increasing order. (b) If the list does not contain a node whose symbol is identical to the string specified in the command, then a new node must be created. The symbol stored in the new node is the string specified in the command and the count stored in the new node must be 1. The new node must be nserted at the en d of the st. Note that the ins command does not produce any output

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 Databases Questions!