Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C, please answer Part B. Ive included the instructions for Part A. This assignment involves two different and independent programs: The first program (Program

Using C, please answer Part B. Ive included the instructions for Part A. image text in transcribed
This assignment involves two different and independent programs: The first program (Program A) will (must) build, print and search a linked list. The second program (Program B) will (must) build, print and sort a contiguous list (it is easier to sort a contiguous list than a linked list). A. Write a program (Program A) that creates a linked list of 100 nodes, each containing a random positive integer between 0 and 99. The program must provide the user with four choices: Build the list; Print out the list; Search the list; and Quit.Hint: Use a switch structure in a while loop, where each of the first three choices in the switch leads to a UFD that does the work (Build, Print out or Search the list). Of course, Quit is trivial and does not need a UFD. 1 1 point) Build the list and assigns a value (random integer between 0 and 99) to each node. 2) (1 point) Prints out the contents of the list to screen. For example: (you can either start from 0 or from 1-it doesn't matter) Nde #1 contains the value of 71 Node #2 contains the value of 36 Node #3 contains the value of 19 Node #100 contains the value of 27 3) (1 point) Asks the user what number she wishes to find in the list and searches for the first instance of that number. The search must return (i.e., print to screen) the node number in which the entry was found, so the program must keep count of the nodes it has visited. Assume the list is unordered (which of course, it is). If the number is not found in the list, it must say: The search has failed. For output, the program must found in the nh node. For example: print out one line indicating that the value sought was Please enter the number to be sought in the list: >15 The number 15 was found in node #81 B. (1 point) Write a second program (Program B) that builds a contiguous list (i.e., array- based), also of 100 elements (cells), each containing a random integer between 0 and 99. You encouraged to re-use as much code from Program A as you wish (this is called code re- sue and it is a good thing). This program must: 1) Build the contiguous list (i.e., the properly populated array). 2) Print out the contents of the list. Use the same output format you used for part A.2 except call it a "cell" and not a "node" Sort the list using the insertsort algorithm. Print out the list automatically after it has been sorted. Use the same printout format as in part B.2 above 3) 4)

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

what are soda / carbonated drinks companies doing to be healthier

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago