University of Waterloo
CS240, Spring 2022 Assignment 0
Due Date: Wednesday, May 11, 2022 at 5:00pm
Please read https://student.cs.uwaterloo.ca/~cs240/s22/assignments.phtml#guidelines for guidelines on submission. For problems 1 – 6, submit your solutions electronically as a
PDF file using MarkUs. This assignment is worth up to 6 bonus marks, which will be added
to your total mark (raw score) for assignment 1.
Introduction
A0 is designed to introduce you to LATEX. We strongly encourage students to create all their assignment solutions using LATEX, as it will strongly benefit both you and your mark- ers. While LATEX is not required for CS240, non-LATEX submissions are expected to be of comparable presentation and sufficiently messy, hard-to-read solutions1 may be penalized.
Learning LATEX is a great asset to have for any course, and also especially for those of you planning to go into academia. As a beginner in LATEX, like in HTML, it is best to start with an example. (And like HTML, LATEX comes with considerable legacy; some features are clearly deprecated, but still exist for backward compatibility)
To complete the problems below, open the LATEX file used to make this PDF. Inside the file you will find the code used to write this file along with comments explaining the code to help you get through the assignment. If you get stuck there are also many on-line resources you can use; in particular http://tex.stackexchange.com is a valuable resource. Searching for “fraction example LATEX” is acceptable; searching for “LATEX proof of summation from 1 to n” is not acceptable (academic violation).
To compile the .tex file provided simply type “pdflatex a0.tex” in the school’s Linux environment. LATEX compilers are also free to download on-line. Submit both a0.pdf and a0.tex to MarkUs.
1What exactly “hard-to-read” means is at the marker’s interpretation – if you want to be sure it is readable, use LATEX!
程序代写 CS代考 加QQ: 749389476
0 Academic Integrity Declaration
As part of every asessment in this course you must read and sign an Academic Integrity Declaration before you start working on the assessment and submit it before the deadline. The agreement will indicate what you must do to ensure the integrity of your grade. Failure to do this before the deadline will lead to a grade of 0 for the entire asessment.
Read, sign and submit A00-AID.txt now or as soon as possible.
1 Assignment Guidelines
At the top of this page is the URL to the assignment guidelines for CS240, it can also be found from the course webpage from the Assignments tab. Please answer the following questions about the assignment guidelines:
a) If an assignment question asks you to design an algorithm, what are the three other things you must do in addition to describing/writing the pseudocode for the algorithm?
b) For programming questions, what programming language do you have to use? To what system should you upload your code?
2 Mathematics
In CS 240, you will be using many mathematical concepts. It is important to be able to typeset mathematics in your assignments. This will include sums, fractions, subscripts & superscripts, etc.
vlgn ̄ utXin0θ
f(n):= 4 2i . i=0
In order to practice this skill, write a proof showing: Xn n(n + 1)
Hint: For short formulas, we use inline math surrounded by $: “Let n ≥ 1 be a positive integer.” Whitespace is ignored in math mode.
CS 240 introduces many tree data structures. Here is a BST on six letters of the alphabet. Insert the first three letters of your first name into the tree (if your first name is shorter than three letters, simply insert all the letters), starting with the first letter of your name. If you are inserting duplicate letters:
Code Help, Add WeChat: cstutorcs
(1) Find the largest index of the letter you are inserting.
(2) Insert your letter, with an index one larger than the index you found. (3) When comparing to an equal value, break the tie according to the index.
For example, if you were to insert an ‘M’ into the tree below, it would be entered as M1 and it would become the left child of T0. Only show the resulting tree.
Hint: For nodes with only one child, you should use “child[missing]” for the non- existent child to keep the binary search tree looking appropriately.
CS 240 also deals with many graphs and plots. Plot the following points below, the first one has already been done for you. Only show the resulting plot.
Points: (2,7), (7,1), (4,5), (1,3), (3,2), (6,6), (0,9), (9,8), (8,0), (5,4)
Occasionally, you may want to present information in a table. In LATEX you can easily present data in well-structured tables. Fill in the table below with any animal you like.
Animal’s Name Avg. Weight Longevity Avg. Temperature Conservation Status Polar Bear 350-700kg 25 years 37◦C Vulnerable
You may find it too time-consuming to do parts of your assignment in LATEX, at which point you may want to include an image of your work. LATEX also supports images. Please keep your image sizes small both for this assignment and future assignments, the total file-size must be at most 5MB. However, be sure that your images can be easily read by your markers, or you run the risk of losing marks.
For this question, include an image of the animal you added to the table in Q5 along with a caption (see example below).
Figure 1: Polar Bear.
Hint: (figure is a floating environment that gets put where it nicely fits the page layout. The optional argument says which positions are acceptable for the float: top/bottom of a page, here, and on a separate page of floats.)
Code Help