0% found this document useful (0 votes)
75 views

Assignment 2 - COMP9123

comp2123 study notes

Uploaded by

efe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Assignment 2 - COMP9123

comp2123 study notes

Uploaded by

efe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

COMP9123 Assignment 2 s1 2024

This assignment should be submitted via Grade-scope. All submitted


work must be done individually without consulting some-one else’s solutions
in accordance with the University’s “Academic Dishonesty and Plagiarism”
policies.

The main purpose of this assignment is to see your programming skills (pseudocode).
While you can do this assignment just writing in English (with full marks), it is
encouraged to use pseudocodes (and comments). Do not forget to read the section:
“Advice on how to do the assignment.” As an aside, if you need a general refresher on, or
have some specific questions, please ask on Ed.

Assignment 2
Student Record Management System
60 points - Due on April 12, 23:59

You are an admin staff at The University of Sydney and have been asked
to create a student record management system for all the students in
your Data Structures & Algorithms tutorial.

To implement this, you have decided to use a Binary Search Tree to


manage student records, where each node stores a student record based
on their student ID (key).

Your system will need to do the following:

• Define a Student variable to represent student records with


attributes such as student ID, name, and GPA.

• Validate the correctness of the implementation by verifying that


the binary search tree property is maintained after each insert or
delete operation.

• Implement an operation to insert a new student record into the


binary search tree: Ensure that student records are inserted in such a
way that the binary search tree property is maintained (i.e., left child <
parent < right child). (operation No. 1 )

• Implement an operation to delete a student record from the


binary search tree based on their student ID: Handle different cases of
deletion, such as nodes with no children, one child, or two children.
(operation No. 2 )

• Implement an operation to search for a student record based on


their student ID: Return the student record if found or indicate if the
student record does not exist in the binary search tree.(operation No. 3)
1
COMP9123 Assignment 2 s1 2024

• Allow additional operations like:

o Find the minimum GPA (operation No. 4 )

o Find the maximum GPA (operation No. 5 )

o Updating student GPA. You traverse the tree through


the student ID (key) (operation No. 6 )

o finding all students with the exact name (Ex. If you


search Peter Parker, all students named peter parker should
be shown). (operation No. 7)

o finding all students in a gpa range (Ex. If you search


between two numbers, all students with gpa in that range
should be shown). (operation No. 8)

o Printing all the student names in Level-order traversal


(first the root, then all the elements from left to right in
level 1, then level 2, then level 3 until we reach the last level
of the bst. You traverse the tree through the student ID (key)
(operation No. 9)

o Check if the Student Record Management is balanced


(all levels differ by at most 1), if not improve balance through
techniques like rotations. The bst does not need to be always
balanced. this operation will balance it though. (operation
No. 10)

You should strive to make your implementation as efficient as possible.

For each of the ten operations:

a) Design an algorithm that solves the problem.

b) Argue the correctness of your algorithm.

c) Analyze the running time of your algorithm.

The implementation is encouraged to be in pseudocode but English description


will also be accepted.

Start summarizing your ideas, no more than one page per operation is allowed.

2
COMP9123 Assignment 2 s1 2024

Advice on how to do the Assignment


• Assignments should be typed and submitted as pdf (no handwriting)

• When designing an algorithm or data structure, it might help you (and us)
if you briefly describe your general idea, and after that you might want to
develop and elaborate on details. If we don’t see/understand your general
idea, we cannot give you points for it.

• Be careful with giving multiple or alternative answers. If you give multiple


answers, then we will give you marks only for "your worst answer", as this
indicates how well you understood the question.

• Some of the questions are very easy (with the help of the lecture notes or
book). You can use the material presented in the lecture or book without
proving it. You do not need to write more than necessary.

• When giving answers to questions, always prove/explain/motivate your


answers.

• When giving an algorithm as an answer, the algorithm does not have to be


given as (pseudo-)code.

• If you do give (pseudo-)code, then you still have to explain your code and
your ideas in plain English.

• Unless otherwise stated, we always ask about worst-case analysis, worst


case running times etc.

• As in the lecture, and as is typical for an algorithms course, we are inter-


ested in the most efficient algorithms and data structures.

• If you use additional resources (books, scientific papers, the internet, etc.)
to formulate your answers, then add references to your sources.

• If you refer to a result in a scientific paper or on the web, you need to


explain the results to show that you understand the results and how it was
proven.

You might also like