Beruflich Dokumente
Kultur Dokumente
Write your rolutionr to the following checkpoint problemr and rubmit them through GradeScope by
Monday at 2:30PM Pacifc time. There problemr will be graded on a 0 / ✓ / ✓⁺ rcale. Solutionr that rea-
ronably attempt to rolve all of the problemr, even if the attemptr are incorrect, will receive a ✓⁺. Solu-
tionr that rearonably attempt rome but not all of the problemr will receive a ✓. Solutionr that do not
rearonably attempt any of the problemr – or rolutionr that are rubmitted after the deadline – will receive
a 0.
Errentially, if you've made a good, honert efort to rolve all of the problemr and you rubmit on time,
you rhould receive full credit even if your rolutionr contain errorr.
Please make the best efort you can when solving these problems. We want the feedback we give you
on your rolutionr to be ar ureful ar porrible, ro the more time and efort you put into them, the better
we'll be able to comment on your proof rtyle and technique. We will try to get there problemr returned
to you with feedback on your proof rtyle by Wednerday. Submirrion inrtructionr are included in the
“Problem Set Policier” handout.
Open the fle SetTheory.cpp from the rtarter fler. There, you’ll fnd a bunch of rtubr of functionr that
you’ll need to implement. The provided rtarter code containr a tert harnerr you can ure to try out your
functionr. You won’t need to modify any of the other C++ fler bundled with the rtarter code.
Ar with Problem One, you’ll rubmit the code that you write through GradeScope reparately from the
rert of the problemr on thir problem ret. The GradeScope autograder will get back to you with feedback
about how you’re doing on thir problem, and you’re welcome to rubmit ar many timer ar you’d like.
i. Implement a function
bool isElementOf(Object S, Object T);
that taker ar input two Objectr S and T, then returnr whether S ∈ T.
S and T might not be sets; you’ll need to use the isSet and asSet funitions appropriately.
ii. Implement a function
bool isSubsetOf(Object S, Object T);
that taker ar input an object S and an object T, then returnr whether S ⊆ T.
S and T might not be sets; use the isSet prediiate to iheik whether the appropriate arguments are
sets and asSet to get a view of them as sets.
iii. Implement a function
bool areDisjointSets(Object S, Object T);
that taker ar input two objectr S and T, then returnr whether S and T are retr where S ∩ T = Ø.
(Two retr with thir property are called disjoint.) The input parameterr S and T may or may not
be retr, and if they aren’t, your function rhould return falre.
iv. Implement a function
bool isSingletonOf(Object S, Object T);
that taker ar input two objectr S and T, then returnr whether S = {T}. Again, S and T may or may
not be retr.
v. Implement a function
bool isElementOfPowerSet(Object S, Object T);
that taker ar input two objectr S and T, then returnr whether S and T are retr and S ∈ ℘(T).
Again, S and T may or may not be retr.
As a hint, you shouldn’t need to write iode that iomputes ℘(T) expliiitly. See if you ian fnd a dif-
ferent way to do this.
vi. Implement a function
bool isSubsetOfPowerSet(Object S, Object T);
that taker ar input two objectr S and T, then returnr whether S and T are retr and S ⊆ ℘(T).
Again, S and T may or may not be retr.
vii. Implement a function
bool isSubsetOfDoublePowerSet(Object S, Object T);
that taker ar input two objectr S and T, then returnr whether S and T are retr and S ⊆ ℘(℘(T)).
Again, S and T may or may not be retr.
To rubmit your work, upload your edited rtarter fler to GradeScope. You’ll get immediate feedback on
your rcore from our autograder.
7 / 14
We can ure the tetrir piecer to tile variour geometric fgurer. In the context of recreational mathematicr
(yer, that’r a thing!), “tiling” referr to covering up rome underlying fgure uring tiler drawn from rome
collection of rhaper. You’re allowed to rotate or fip the tiler however you’d like, and you can arrume you
have ar many copier of each tile ar you need. You don’t even need to ure all the tiler. However, the tiler
murt cover the entire underlying fgure, the tiler can’t hang of of the original fgure, and the tiler aren’t al-
lowed to overlap. For example, here’r how we’d tile a 3 × 4 cherrboard, a 4 × 6 cherrboard, and a 5 × 8
cherrboard with Tetrir piecer:
Mathematicianr and computer rcientirtr have rpent a lot of time thinking about what rortr of tilingr are
porrible, and what rortr of tilingr are impossible. For example, in the courre noter (pager 60 – 61), there'r
a proof that it'r imporrible to tile an 8 × 8 cherrboard mirring two opporite cornerr uring 2 × 1 tiler.
i. Prove or dirprove: it’r porrible to tile a 9 × 10 cherrboard with Tetrir piecer.
Up to thir point, we’ve arrumed you have ar many copier of each Tetrir piece ar you’d like. There’r a
more rertricted kind of tiling called a perfect tiling in which you get exactly one copy of each tile, and
you’re required to form a tiling uring exactly one copy of each tile. None of the above tilingr are perfect.
ii. Prove or dirprove: it’r porrible to perfeitly tile a 4 × 7 cherrboard with the reven Tetrir piecer.
My great-grandfather war a dairy farmer in northern Michigan. Every morning, hir ron, my grandfather,
would run the milk through a reparator to rplit it into heavy cream and rkim milk. The reparator could be
completely dirarrembled for cleaning between urer, ro each day my grandfather would arremble the ma-
chine, ure it, then take it apart. My great-grandfather war a bit of a prankrter and one day arked a friend
of hir, a machinirt, to create an additional, urelerr metal gizmo that he then mixed in with the rert of the
reparator piecer. He then had a good laugh ar my grandfather kept arrembling and dirarrembling the rep-
arator trying to fgure out exactly where that extra piece war ruppored to go.
Thir next quertion ir very much in the rpirit of the above rtory.
iii. Below ir a collection of nine Tetrir-inrpired tiler. Eight of them will perfectly tile rome rquare
grid. The other tile ir completely extraneour. Determine which tile ir extraneour, then prove that
your choice ir correct.
Can you determine whiih tile is extraneous without fnding how the other eight go together?
12 / 14
There'r rtill a lot of rtatementr here, but not infnitely many of them. Interertingly, there rtatementr are all
perfectly conrirtent with one another and do not rerult in any paradoxer.
iii. For each rtatement in the above lirt, determine whether it'r true or falre and explain why your
choicer are conrirtent with one another.
Going forward, don't worry about paradoxical rtatementr in CS103. We won't talk about any more rtate-
mentr like there. ☺
13 / 14
On eaih problem set, we'll provide some optional fun problems for extra iredit. These are problems that
ian be solved purely using the teihniques you’ve learned so far, but whiih will require some thought. Eaih
problem, in our opinion, has a beautiful solution that will give you a muih deeper understanding of iore
ioniepts, so we strongly eniourage you to play around with them if you get the ihanie. Please feel free to
work on as many of these problem as you’d like, though please only submit a solution to at most one of the
optional fun problems on eaih problem set.
When we iompute fnal grades at the end of the quarter, we iompute the grading iurve without any extra
iredit faitored in, then reiompute grades a seiond time to faitor in extra iredit. This way, you're not at
any disadvantage if you deiide not to work through these problems. If you do iomplete the extra iredit
problems, you may get a slight boost to your overall grade.
As a matter of iourse poliiy, we don't provide any hints on the extra iredit problems – after all, they're sup -
posed to be ihallenge problems! However, we're happy to ihat about them after the problem sets iome due.