Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c language Definition of the Problem : Basic operations are Insertion, Deletion , Searching and Sorting using linked list data structures. Telephone directory system of

c language
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Definition of the Problem : Basic operations are Insertion, Deletion , Searching and Sorting using linked list data structures. Telephone directory system of the subscribers have the following information fields. Telephone number, Name, Last name. Structure of the "telephone.txt" file has the following fields Telephone Number(7) Name(12) Last Name(12) You may define your node structure as follows struct tlpInfo long telNumber; char firstName[12]; char lastName[12]; \}; struct node \{ struct tlpInfo info; struct node *link; \}; typedef node *NODEPTR; operations: 1. (10 Points)Read from the file "telephone.txt" and create a linked list - Display Linked list structure. 30 Person on each page. 2. (15 points)Read from the file "telephone.txt" and create a Sorted linked list structure (using telephone Number in ascending order). Use insertion sort method - Display sorted list structure from the monitor(Telephone number, name, last name of the subscriber), 30 Person on each page. 3. (15 Points)Sort by name in ascending order(Using same insertion sort method again)) . - Display(sorted base on name) subscriber information(Telephone number, name, last name of the subscriber), 30 Person in each page. Use string function 4. (15 points). New Subscriber Insertion Read a new Subscriber information (Telephone number, name, last name) as a user's keyboard input, and Insert his/her information into the proper location in the sorted linked list structure. Afterwards, - Display all subscriber information based on telephone numbers). Before insertion, linked list structure must be sorted based on telephone numbers. 5. (15 points) Search a person using a given name and last name and list subscriber information Read a name, last name from the keyboard and using sorted linked list information based on name. - Search the person from the sorted linked list and find and display subscriber information. Give error message if person is not in the linked list structure. Duplicated names will be checked using last names. 6. (15 points)Search and Delete Read a subscriber information(Telephone number) from keyboard , find and Delete corresponding subscriber from the sorted linked list structure. After confirmation (yeso). Check all necessary conditions. If given subscriber information is not in the linked list, your program must give an error messages and repeats the input . After deletion, - Display subscriber information 30 Person on each page. Example Program: Following program creates a linked list structure using given file "telephone.txt" and list linked list structure at the same time. \#include \#includeh> \#include \#include struct tipinfo\{ long telnumber; char firstName[12]; char lastName[12]; struct node \{ struct tipinfo info; struct node *link; b. typedef node "NODEPTR; NODEPTR getnode(); void filelntoLinkedList(NODEPTR *); void display(NODEPTR head); int main() \{ NODEPTR head,p,save; head=NULL; fileintoLinkedList(\&head); display(head); return 0 ; \} void display(NODEPTR head) \{ int i=0,j=0; NODEPTR save=head; printte \% 7d%10 s %10sin ", save-3info,telnumber, save- >info.firstName,save->info lastName): 1 ) void fleintoLinkedList(NODEPTR thead) f struct Epinlo temp: NODEPTR save.p; FILE "a=fopen("telephone tut","r"): while(fscanf(a, % id % s \%sin", \&temp, teinumber, temp. firstName, temp. lastName) = EOF) p= getnode (; p-sinfoetemp; I printf("H/d \%s \%sin". temp.telnumber temp.firstName, temp. lastName if ("head ==NULL) ("head =p : save=p; saverp; \} 1 p> link=NULL; 1 NODEPTR getnode() NODEPTR q : q=(NODEPTR) malloc(sizeoflstruct node ); return q; y

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

LO6 List the components of job descriptions.

Answered: 1 week ago

Question

LO3 Define job design and identify common approaches to job design.

Answered: 1 week ago