So we read in each number and add the number to an ordered


We have a list of numbers and we need to know two things, what numbers we have and how many of each number do we have in the list.

So we read in each number and add the number to an ordered linked list. If we are adding a number to the list and we find that number, then we will just count it. If we do not find the number in the linked list, then we will add a new node to the linked list with the new number and set the count to one.

The linked list node will have three fields - the number, a counter for the number and a link field.

Write a C++ program to achieve what we want, and print out the values and their counts, say 5 per line.

Example:

5(22) 8(15) 13(5) 22(3) 25(18)
where 5 is the number and 22 is its count.

Please use the attached input file "LinkNbrs.dat" for testing the program.

Attachment:- LinkNbrs.zip

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: So we read in each number and add the number to an ordered
Reference No:- TGS01246051

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)