Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Lab7 and Lab8

Due: Friday, December 3, 2021 before 11:59PM

Instructions:
• All labs are to be completed individually: no group work is allowed.
• Do not discuss solutions with anyone other than the instructor or the TAs.
• Do not copy or look at specific solutions from the net.
• Academic honesty will be strictly enforced in this course. Specifically, direct collaboration
(e.g., sharing code or answers) is not permitted, and plagiarism detection software will be
employed. Students are expected to read the Senate Policy on Academic Honesty. See
also the EECS Department Academic Honesty Guidelines.
• Your code should include Javadoc comments.
• The lab will be graded not only by JUnit tests given to you (if any) but also by additional
tests covering some other input values. This is to encourage you to take more
responsibility for the correctness of your code by writing your tests using custom testers
that can handle the boundary cases and error conditions.
• There will be a 40% penalty on your lab final grade if your submitted code does not
compile due to minor compilation errors, given that TAs can fix these minor
compilation errors. You will receive a zero if your code contains significant compilation
errors that TAs can not fix. To be on the safe side, make sure that your submission is
compilation error-free. Since any minor/trivial compilation errors can cause or escalate
to significant compilation errors that TA can not trace its origin.
• The deadline is strict with no excuses: you receive 0 for not making your electronic
submission in time. Emailing your solutions to the instructors or TAs will not be
acceptable.
• To submit your work, you need to use the York eClass.

GETTING STARTED
1. Start eclipse.
2. Download the following zip file/project file from eClass.
3. Import the test project by doing the following:
1. Under the File menu, choose Import...
2. Under General, choose Existing Projects into Workspace and press Next
3. Click the Select archive file radio button, and click the Browse... button. You may
have to wait about 10 seconds before the file browser appears.
4. In the file browser that appears, navigate to your home directory.
5. Select the file Lab78.zip and click OK
6. Click Finish.
4. All of the files you need for this lab should now appear in eclipse.

Page 1 of 5
Lab7 and Lab8
Due: Friday, December 3, 2021 before 11:59PM

Lab Restrictions:
• Read through the lab to get a basic idea of the requirements and then start working
through the lab in the recommended order.
• Do not modify Tree.java, Position.java, and BinaryTree.java classes.
We overwrite these files and other files with the originals when we test your code.
• DO NOT change the class signature for the YorkLinkedBinaryTree or
YorkBinarySearchTree class. It needs to stay as-is.
• You are allowed only to use the following built-in library classes
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;

• It is strictly forbidden for you to use any library class not listed above (e.g.,
HashSet) and any java.util implementations of Collection or Map
interfaces to complete this lab. Violating this requirement will cause
your lab marks to be zero.

Grading Criteria:
• YorkLinkedBinaryTree and YorkBinarySearchTree class correctly
implement all the required interfaces methods and all the additional methods defined
inside YorkLinkedBinaryTree and YorkBinarySearchTree classes.
• You will be responsible for testing your code instead of being
given the main tester class.
• The lab will be graded by JUnit tests given to you (if any) and by additional tests
covering some other input values. This is to encourage you to take more responsibility
for the correctness of your code by writing your tests using custom testers that can
handle the boundary cases and error conditions.
• There will be a 40% penalty on your lab final grade if your submitted code does not
compile due to minor compilation errors, given that TAs can fix these minor
compilation errors. You will receive a zero if your code contains significant compilation
errors that TAs can not fix. To be on the safe side, make sure that your submission is
compilation error-free. Since any minor/trivial compilation errors can cause or escalate
to significant compilation errors that TA can not trace its origin.

Page 2 of 5
Lab7 and Lab8
Due: Friday, December 3, 2021 before 11:59PM

Learning Objectives
• Implement Tree and Binary Tree ADT by using a linked list structure.
• Implement binary search tree.
• Implement several tree traversal algorithms

Page 3 of 5
Lab7 and Lab8
Due: Friday, December 3, 2021 before 11:59PM

Introduction:
1. First, look at the lab78 package. You will find the Tree.java, Position.java, and
BinaryTree.java interfaces. Examine Tree.java, Position.java, and
BinaryTree.java detail. Read comments carefully and understand what each
method does clearly. Then, you will see an almost empty
YorkLinkedBinaryTree.java and YorkBinarySearchTree.java. In
this lab, you need to implement YorkLinkedBinaryTree.java and
YorkBinarySearchTree.java correctly.
2. There are additional methods defined inside YorkLinkedBinaryTree.java and
YorkBinarySearchTree.java that you have to implement. Read the Java
documentation carefully and then implement these methods.
3. Make sure you understand generic types (the E and <E>) in the lab5 source code. The
generics are explained in Sun's tutorial at Generics.
4. While you are implementing the YorkLinkedBinaryTree.java and
YorkBinarySearchTree.java, besides typing the source code, you should also
a. Write good comments to document source code
b. You will be responsible for testing your code instead of
being given the main tester class.

Remember: The lab will be graded by JUnit tests given to you (if any) and by
additional tests covering some other input values. This is to encourage you to
take more responsibility for the correctness of your code by writing your tests
using custom testers that can handle the boundary cases and error conditions.

Page 4 of 5
Lab7 and Lab8
Due: Friday, December 3, 2021 before 11:59PM

Submission: Submit your work by using the course eClass


• To submit your work, you need to use the York eClass.
• Remember that you first need to find your workspace directory and then find your
project directory. In your project directory, your files will be located in the directory
src/lab<??>
• You need to submit only the inside YorkLinkedBinaryTree.java and
YorkBinarySearchTree.java files via eClass (no zipping is required).
• You cannot submit more than one file, and the submitted file should be .java.
• The deadline is strict with no excuses: you receive 0 for not making your electronic
submission in time. Emailing your solutions to the instructors or TAs will not be
acceptable.

Page 5 of 5

You might also like