Assignment 2 ============ The goal of this assignment is to familiarize yourself with web programming techniques. Although you will (likely) need to write a small amount of `HTML`_, `CSS`_, or `Javascript`_, the focus is on the technology running on the server which can be written in any language you like. .. _HTML: https://developer.mozilla.org/en-US/docs/Web/HTML .. _CSS: https://developer.mozilla.org/en-US/docs/Web/CSS .. _Javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript Projects -------- This course will finish with a :ref:`project `. Please submit a proposal for what you'd like to do, along with who you're working with. Groups of 3-4 are preferred, but I'm open to suggestions. The scope of the project should reflect the size of the group. You should support the following URLs and methods. - GET ``/project`` Return an HTML page summarizing your project proposal. Web application --------------- You will turn in this assignment by creating a web application. This application will serve up your answers to questions as well as provide an interface to the code you will write. Binary heap ~~~~~~~~~~~ You will implement a a minimum priority queue via a `binary heap `_. You will implement two versions of the heap: one using the pointer definition, and one using the array definition. You should support the following URLs and associated operations. - GET ``/heap/`` Return the status of the heap stored a the URL ``/heap/``. For example, a GET request to ``/heap/0`` should return the status of heap 0. The status should be a human-readable representation of the heap. At the very least it should report the size of the heap and the current top element. - POST ``/heap/`` Push a new element onto the heap. If the heap doesn't exist (or is empty), create it. The pushed element should be stored in the form named ``value``, i.e. the following HTML form could add a value to the heap 0: .. code-block:: html
- GET ``/heap//pop`` Pop and return the top element of the heap. It is an error to pop from an empty heap. - GET ``/heap//peek`` Return the top element of the heap, leaving it unchanged. It is an error to peek on an empty heap. - GET ``/heap/time/array?length=LENGTH&seed=SEED`` Time the performance of inserting ``LENGTH`` random elements onto the array heap, and then popping them all off. The random sequence should be controlled by the ``SEED`` value. You should return two values, the time required for inserting the elements and the time required for popping the elements. - GET ``/heap/time/pointer?length=LENGTH&seed=SEED`` Time the performance of inserting ``LENGTH`` random elements onto the pointer heap, and then popping them all off. The random sequence should be controlled by the ``SEED`` value. You should return two values, the time required for inserting the elements and the time required for popping the elements. Source code ----------- I want to be able to the code you used to create this service. Host a Git `bare repository `_ containing your work for me to clone from. - GET ``/git`` Returns the Git repository that I can clone from. Submission ---------- Ideally you will host your project somewhere that I can test it. This can be on a personal computer, a cloud server, or a cloud service. If you want to use a personal computer, talk to me about how we can test this (you might just end up sending me the code so I can run it locally). If you host it on a cloud server or service, send me the URL. Note that services such as `Heroku `_ and `Amazon Web Services `_ offer (some amount of) free hosting. Regardless of how you turn in your assignment, your code should be `well tested `_. Include these tests in your Git repository.