Sale!

Homework Assignment 7 COP 3223C solved

Original price was: $30.00.Current price is: $25.00. $21.25

Category:

Description

5/5 - (1 vote)

Homework Assignment 7 COP 3223C

This assignment involves searching and sorting. We will search a linked list and sort a
contiguous list (it is easier).

1) (3 pts.) We want to build a linked list of 100 nodes, each containing a positive integer
between 0 and 99 in reverse order (i.e., the first node will contain the number 99; the
second 98; the third 97 and so on).

Write a program in C that a) builds the list; b) Ask the
user what number she wishes to find in that list; c) search for that integer in the linked list
you built under part a above; d) Return the position of the node in which you found the
number requested.

Assume the list is unordered (which of course, is not the case here), and
search the entire linked list sequentially until the node containing the desired number is
found. If the number is not found (say the user enters 202), it should say that the search
failed.

Set up the user entry capability in a loop so that the user can enter numbers repeatedly if
she wants. That is, when a number entered is found (or not found), it will give her an
opportunity to enter a new number. If the user no longer wants to use the program, she
should enter ‐1.

For output, print out a line stating that the value sought was found in the nth node. For
example:

Please enter the number to be sought in the list:
>> 15

The number 15 was found in node #85
2) (3 pts.) Write a program in C that:
a. Builds a contiguous list of 100 cells.
b. Populates the cells with random integers between 0 and 10,000.
c. Prints out the list.

d. Sorts the list in increasing order using the InsertSort algorithm.
e. Prints out the list after sorting.
Note 1: This assignment cannot be turned in late! The deadline for all late assignments is
exactly the same as the due date for this assignment.

Note 2: No constraints on how the program is written other than it must be written by the
student, in C and work correctly in Code::Blocks.
Homework Assignment 7 COP 3223C