Site icon UK Essayz

Data Structures and Algorithms

Create a linked list based bag implementations to maintain “unsigned integers”. You can modify the program under (BagLinked_List.cpp) for this assignment.
Your class should provide followings functionalities:
add(…) // insert new item to the bag
average(…) // returns average of the numbers of the bag
In the main() function, create a bag, then
1. Add 500 random numbers between 50 and 100.
2. Then add 500 random numbers between 100 and 150.
After adding each numbers, call average(…) and show the average of items of the bag so far. This means you will add total of 1000 numbers and call average(…) 1000 times to see average after each addition.