CS 119 Lab 10Abstract Data Types: Bags (Multisets)

Objectives

  • Use a Bag
  • Perform the following tasks in the order given.

    1. Download the Lab10 project and import it into Eclipse as a Haskell project.
       
    2. Create a module and import the Bag module.  Create a couple of bags containing the letters "HELLO" and "WORLD".  Make sure you understand why the bags are created as they are and that they maintain our heap property.
       

    3.  
      Assignment:
      Write a function sortBag :: (Ord a) => Bag a -> [a] which returns a list of the items in the bag in sorted order.  You should be able to do this using only the given operations on bags.


       

    4. Assignment:
      What is the efficiency of the sortBag function?


       

    5. Email your modified zipped project to me for grading.