Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that does the following 1) Declare a linked list data structure node with the following elements: a character and a pointer

image text in transcribedimage text in transcribedimage text in transcribed

Write a C program that does the following 1) Declare a linked list data structure "node" with the following elements: a character and a pointer to the next node. (2 points) 2) Asks the user to enter n characters (of datatype character) into a linked list. (3 points) 3) After the insertion of each character, the user is asked whether they wish to proceed with further insertion. (5 points) 4) Create a function called Instructions that prints the menu to be displayed to the user. (5 points) 5) Create a function called insert that inserts the data into the linked list. One of the insertions should be the first letter (in capital case format) of your first name. (10 points) 6) Create a function called isEmpty that returns 1 if the linked list is empty. Otherwise, Q. Hint: you may call this function while checking if your list empty. (10 points) 7) Create a function called PrintList that prints the characters of the linked list with the usage of recursion. (15 points) A sample output should like as follows (It's in alphabetical order except for the capital case insertion that is located in the beginning of the list): Enter your choice: 1 to insert an element into the list. 2 to end. ? 1 Enter a character: f The list is: f --> NULL ? c The list is: --> f --> NULL ?s The list is: c --> f --> S --> NULL ? B The list is: B --> --> f --> 5 --> NULL ? a The list is: B --> a --> C --> f --> S --> NULL ? 2 End of run. 8) Change the function PrintList properly so that it prints the characters of the linked list in reverse order. (15 points) Sample output for question 8: Enter your choice: 1 to insert an element into the list. 2 to end. ? 1 Enter a character: f The list is: f --> NULL 2. Enter a character: The list is: If --> --> NULL ?s Enter a character: The list is: s --> f --> C --> NULL ?B Enter a character: The list is: s. --> f --> --> B --> NULL ? a Enter a character: The list is: Is --> f --> C --> a --> B --> NULL ? 2 End of run. execution time : 23.129S Process returned @ (exe) Press any key to continue. 9) Create a function called CountNodes that calculates and prints the number of the nodes in the linked list. (10 points) Sample output for question 9: Enter your choice: 1 to insert an element into the list. 2 to end. ? 1 Jenter a character: f The list is: If --> NULL ?C The list is: If -->--> NULL 25 The list is: Is --> f -->--> NULL ?B The list is: Is --> f --> --> B --> NULL ? a The list is: ls --> f --> C --> a --> B --> NULL ? 2 The number of nodes is: 5 End of run. execution time : 59.912 s Process returned @ (exe) Press any key to continue

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago