Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Comment on everything you do and make sure it compiles before submitting it. Complete everything please no short cuts. You are required to write an

Comment on everything you do and make sure it compiles before submitting it. Complete everything please no short cuts.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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 255, a positive integer (i.e., an integer value 2 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 text and the index for that node respectively. Initially, the list is empty. At all times, the existing list must satisfy the following requirements 1. The index is a number of the node in the list, i e. the first node has index 1, and when the list is scanned from the beginning to the end, the value of indexes is increasing by 1 2. The texts appearing in the list are all distinct; that is, no two nodes have the same text. The commands and their interpretations are as follows. (You should bear in mind that different parts of a command are separated by one or more spaces.) A. Command Insert After: The syntax for this command is as follows: ina num str Here, ina represents the name of the command num represents a positive integer number, and str represents a text. The interpretation of this command is as follows (a) A new node with the text specified in the command must be inserted in the list after a node whose index is equal to the number specified in the command, indexes of the list

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

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

Students also viewed these Databases questions