Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3668465 AYDIN SAYAL 3662910 CAN CELBEK 3664508 DILEK ACAR 3666548 ALTAN SABAT 3662409 BASAK TOPLAM Definition of the Problem : Basic operations are Insertion, Deletion

3668465 AYDIN SAYAL
3662910 CAN CELBEK
3664508 DILEK ACAR
3666548 ALTAN SABAT
3662409 BASAK TOPLAM
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; Write a menu driven C program and create a simple sorted linked list data structures which will have the node structures defined as above and do the following operations: 1. Read from the file "telephone.txt" and create a linked list - Display Linked list structure. 30 Person on each page. 2. 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. 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. 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. 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. 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 \#include \#include \#include struct tipinfo\{ long telnumber; char firstName[12]; char lastName[12]; \} ; struct node \{ struct tiplnfo info; struct node "link; \} typedef node *NODEPTR; NODEPTR getnode(); void filelntoLinkedList(NODEPTR); void display(NODEPTR); int main() \{ NODEPTR head,p,save; head=NULL; filelntoLinkedList(head); display(head); return 0 ; \} void display(NODEPTR head) \{ NODEPTR save; save=head; while(savel=NULL) \{ printf("\%ld \%s \%sin", save->info.telnumber,save->info.firstName,save- >info.lastName); save=save->link; \} \} void filelntoLinkedList(NODEPTR head) \{ struct tlpinfo temp; NODEPTR save,p; FILE "a=fopen("telephone.txt", "r"): while(fscanf(a, "\%ld \%s \%sin", \&temp.telnumber, temp. firstName, temp.lastName)=EOF) {p= getnode (); p-info=temp; printf( (% ld %s%sin",temp.telnumber,temp.firstName,temp.lastName); if (head == NULL) (head =p; save=p; \} else\{save->link=p; save =p; \} \} p> link=NULL; \} NODEPTR getnode() \{ NODEPTR q; q=( NODEPTR)malloc(sizeof(struct node)); retum q; \}

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 New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago