Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LINUX C programming Second: Linked List (20 points) In this part, you have to implemeut a linked last that maistains a lst of integers in

LINUX C programming

image text in transcribed

Second: Linked List (20 points) In this part, you have to implemeut a linked last that maistains a lst of integers in sorted order Thss, if the list contains 2, 5 and 8, then 1 will be inserted at the start of the list, 3 will be inserted between 2 and 5 and 10 will be inserted at the end. The list can contain duplicate elements Input format: This program takes a file name as a agument from the command Ene. The file is either blank or contains saccessive lines of input. Each line contains a character, either i or d',followed by a tab character and then an integes. For each of the lines that starts with i', your peograim should insert that amber in the linnd Et in soeted order. If it is already there, your program can srrt it hefte or after the exatig estry. If the line starts with a 'd. your program should delete the first value if it is preseut in the inked list If there are duplicates your program mast delete just the first occurrence of the sale Your program should silently ignore the line if the requested value is not present in the linked list Output format: At the end of the execution your peogram should print the mamber of nodes in the list in the first line of the output and all uvoes of the lined list in sorted order in the next line. Note, while printing the size your peogram st comsider all valses, bat while printing the value you mast print duplicate values just once. The vales should be in a single line separated by tabs. There should be no leading or trailing wihite spaces in the output. Your program should print "error (and mothing else) if the file dons not exist Your program should print 0 followed by a blank line if the input file is empty or the resulting linked list has no nodes Example Execution: Lets assame we have 3 text files with the following contents: filel.txt is empty f4le2.txt: 10 i 12 d 10 1 5 tile3.txt: d 7 10 i 10 d 5 Then the resalt will be: $./second file1.txt $./second file2.txt 5 12 $./second file3.txt 10 $./second filed.txt

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

Define Industry 4.0.

Answered: 1 week ago