Completed file for problem set 6. Remember to copy the pdf file to Dr Racket for a better view. This file should be exactly identical except that the file has answers for each problems.
;; DO NOT PUT ANYTHING PERSONALLY IDENTIFYING BEYOND YOUR
CWL IN THIS FILE.
;; YOUR CWLs WILL BE SUFFICIENT TO IDENTIFY YOU AND, IF YOU HAVE
ONE, YOUR
;; PARTNER.
;;
(require spd/tags)
(@assignment psets/pset-06); Do not edit or remove this tag
;; If you are:
;; - A 110 or 107 student replace the first set of '???'s with your cwl.
;; For problem sets, If you have a partner, please replace the second
;; set of '???'s with their cwl. Remember this, it is what you will
;; do with these @cwl annotations for the whole course.
;; - A UBC Extended Learning student, replace the first set of ??? with
;; your email address as confirmed in the email you received from
;; extended learning. The handin password is also in that email.
;; Remember this, it is what you will do with these @cwl annotations
;; for the whole course.
;;
(@cwl ??? ???)
(@problem 1)
;; Below is the start of a data definition called Course that represents limited
;; information about UBC courses. Below there are only two example data.
;; Please complete this definition by adding constants C110, C213, C313 and
C317
;; which are representations of the descendent tree for 110, 213, 313 and 317.
;; You can find the information you need at
;; https://cs110.students.cs.ubc.ca/psets/pset-06-image.png
;;
;; NOTE 1: Use the information in the image above, rather than any other
source.
;; We are significantly simplying the information.
;;
;; NOTE 2: Do this very carefully, the autograder wants to see correct results
;; from the functions you design to operate on this data.
;;
, ;; NOTE 3: The tree you will make for C110 will be a bit odd because 210 has
110
;; as a pre-req, and both 213 and 221 have 210 as a pre-req, and 313 has
;; 213 AND 221 as a pre-req, and 317 has 213 AND 221 as a pre-req. As a
;; result, 313 and 317 will both show up twice in your descendent tree
; for C110. This is okay for this problem set.
;; NOTE 4: Expect this step of the problem set to take you some time.
(@htdd Course ListOfCourse)
(define-struct course (number credits dependents))
;; Course is (make-course Natural Natural ListOfCourse)
;; interp. a course with a course number,
;; the number of credits the course is worth, and a
;; list of courses that list this course as a direct pre-requisite
;; ListOfCourse is one of:
;; - empty
;; - (cons Course ListOfCourse)
;; interp. a list of courses
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller tranghane. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $6.49. You're not tied to anything after your purchase.