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

Data Structure

The document describes the functions of a university management system project including inserting, removing, searching, modifying, checking debt and salary, and filtering records of students and teachers. It uses a double linked list and text database to store and manage the data in an efficient way.

Uploaded by

21070891
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Data Structure

The document describes the functions of a university management system project including inserting, removing, searching, modifying, checking debt and salary, and filtering records of students and teachers. It uses a double linked list and text database to store and manage the data in an efficient way.

Uploaded by

21070891
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

INS305001

Data Structures
and Algorithms
University Management System

Lecture

Mrs.Tran Thi Ngan

Student name

Tran Viet Dung - 21070726


Nguyen Hoang Anh - 21070902
Ha Thi Hong Anh - 21070345
Nguyen Quang Phuc - 21070794
Nguyen Bich Diep - 21070891
Table of content
1. INTRODUCTION ABOUT PROJECT 2

2. MAIN FUNCTIONS 2

2.1. Insert a new record 2


2.2. Remove a student/teacher record 4
2.3. Search for Teacher/Student Record by ID 5
2.4. Modify Student/Teacher Record 6
2.5. Check debt of student 7
2.6. Check salary of teacher 7
2.7. Filter function 8
2.8. Safety of the system 9
3. ALGORITHMS DESIGN 10
4. COMPLEXITY ALGORITHMS 11

5. TEST CASES 12
WORK BREAKDOWN STRUCTURE 18

1
1. INTRODUCTION ABOUT PROJECT
This project was created using C++ and relies on a double linked list as its main data structure,
coupled with a text database for storing and accessing relevant details. The utilization of a double
linked list brings several advantages to the organization of student and teacher information. It
ensures effective memory management, speedy data search and retrieval, and straightforward
data insertion and deletion. Additionally, employing a text database facilitates easy data storage
and retrieval, enhancing the system's scalability and flexibility.

In summary, the VNU-IS Management System project proves to be a valuable tool for
universities and academic institutions seeking to streamline administrative and academic
processes related to student and teacher management. It provides a comprehensive and efficient
solution for handling student and teacher information, contributing to the enhancement of
education quality and administrative efficiency.

2. MAIN FUNCTIONS
2.1. Insert a new record
These part of code implement the addition of student and teacher records to a linked list in a
system. The `addStudent()` function starts by creating a new student node, prompting the user
to input various details such as ID, name, course, date of birth, address, and unpaid course
credits. It then appends this new node to the linked list, updating pointers accordingly. The
function handles scenarios where the list is initially empty or contains existing records.

Similarly, the `addTeacher()` function follows a comparable process for teacher records. It
allocates memory for a new teacher node, collects information like ID, name, date of birth,
address, and the number of classes taught, and integrates the new node into the linked list.
This accommodates cases where the teacher list is either empty or populated.

2
For student For teacher

Both functions ensure that the new records are appropriately linked within the system, updating
pointers and notifying the user of the successful addition of either a student or teacher. These
capabilities contribute to the effective management of student and teacher information within the
system.

3
2.2. Remove a student/teacher record
The code first checks if the list is empty. If it is, it prints a message and returns. Otherwise, it
prompts the user to enter the ID of the record to be removed.
Next, the code uses a pointer to iterate through the list, comparing the ID of each record to the
ID that the user entered. If a match is found, the code takes the following steps:
If the record is the first or last element in the list, the code simply updates the pointers to
the first or last element, respectively.
If the record is in the middle of the list, the code updates the pointers of the previous and
next records to point to each other, effectively removing the record from the list.
Finally, the code deletes the record from memory and prints a message indicating that the
removal was successful.

For student For teacher

4
2.3. Search for Teacher/Student Record by ID.
For teacher

This function needs two things to work: the head of the linked list and the teacher ID you
want to find. It starts by setting a temporary variable, "current," to the linked list's head.
Then, it goes through the list using a while loop until it either reaches the end or finds the
node with the given teacher ID. If it finds a match, the function shows details about the
teacher, like their ID, name, department, birthdate, and salary. If it checks the entire list
without finding the teacher with that ID, it says the specified teacher wasn't found.

For student

The function also works with two things: a pointer pointing to the linked list's head and the
student ID you want to find. It starts by setting a temporary variable, "current," to the head
of the linked list. Then, it checks each node using a while loop until it either reaches the end
or discovers the node with the specified student ID. If there's a node with the matching ID,
the function shows the student's details, like ID, name, course, birthdate, and unpaid
credits. If it goes through the whole list without finding a node with the desired student ID, it
says that the specified student wasn't found.

5
2.4. Modify Student/Teacher Record.

The code includes functions to update student and teacher records in the system.
The updateStudentRecord() function checks if the student list is empty, and if not,
allows the user to input a student ID for updating. It then prompts the user to
choose the field to update and accepts new information accordingly. Similarly, the
updateTeacherRecord() function performs the same process for teacher records.
Both functions notify the user of the successful update or if no corresponding
record is found. This capability enhances the management system's flexibility by
enabling the modification of student and teacher details as needed.

For teacher For student

In both cases, the code


retrieves the record based on
the provided ID, displays
available options for updating
specific fields, and performs
the update based on the
user's choice.

6
2.5. Check debt of student
The debt checking process involves the user entering the ID of the student to be examined. The
program then iterates through the list of students to find the one with the corresponding ID. Upon
locating the student, it calculates the debt based on the unpaid credits and displays the relevant
information. If the student is not found, the program notifies that there is no debt information for that
particular student.
Enter Student ID
The user is asked to enter the ID of the
student whose debt needs to be
checked.

Find Students in the


linked list
Use the temp cursor to
traverse the linked list
of students and find
students with
matching ID..

Export results
If a student with a corresponding
ID is found, export debt
information.
If not found, output a student not
found message.

2.6. Check salary of teacher


To check a teacher's salary, the user inputs the teacher's ID. Then, the function goes through
the list of teachers to find the one with the corresponding ID. If found, it calculates the salary
based on the number of classes taught and displays the result. If the teacher is not found, the
function outputs a message indicating that the teacher was not found.
Enter Teacher ID
The user is required to enter the
ID of the teacher whose salary is
to be checked.

Find Teachers in the linked list


Use the temp cursor to traverse the list of
teacher links and find the teacher with the
matching ID.

Export results
If a teacher with a corresponding ID is
found, export salary information.
If not found, output a message saying the
teacher could not be found. 7
2.7. Filter function
Our code implements the functionality to filter information about students and
teachers in a university management system. Utilizing two functions, filterStudent()
and filterTeacher(), users can input a search keyword through the getline(cin,
keyword` function. The system then traverses through the lists of students and
teachers to find records that match the entered keyword. Detailed information about
students and teachers, including ID, name, date of birth, address, and other relevant
details, is displayed on the console. The final result is indicated by the message "End
of filtered records," aiding users in easily identifying the conclusion of the filtering
process. The use of getline(cin, keyword) along with keyword verification through
find(keyword) provides a flexible and convenient filtering module for specific
information retrieval within the system.

For teacher

For student

8
2.8. Safety of the system
Making sure our project is safe is super important, especially because it deals with private info
of students and teachers. To keep things secure, we use strong security steps, like needing a
special username and password when logging in. This two-step check doesn't just make our
stored info private, but it's a big wall against people who shouldn't get in. By putting these safety
steps first, we're focused on building a reliable and trustworthy space to handle student and
teacher info in our project.

9
3. ALGORITHMS DESIGN

False

False

10
4. COMPLEXITY ALGORITHMS
The time complexity of an algorithm is a general way to measure how fast it runs on a specific
amount of data. It's like checking how long it takes for the algorithm to finish a task given a
certain amount of data. We often use big O notation to describe this, which tells us the
maximum time an algorithm might take, no matter the size of the data.

In our project, all the functions we use have a time complexity of O(n). This means that as the
amount of data gets bigger, the time it takes for the algorithm to finish also increases in a
straight line. So, if we double the data size, the time it takes will roughly double too.

Functions for adding students and teachers (addStudent and addTeacher) both have a time
complexity of O(1). This is because both functions only involve creating a new record and
updating pointers, regardless of the current number of records.

However, functions for removing students and teachers (removeStudent and removeTeacher)
have a time complexity of O(n). Removing requires traversing the entire doubly-linked list to
find and delete the corresponding record, and in the worst case, all n records must be visited.

Searching for students and teachers (searchStudent and searchTeacher) also has a time
complexity of O(n). Both functions need to traverse the linked list to find the desired record.

Record update operations (updateStudentRecord and updateTeacherRecord) also have a


time complexity of O(n). They require locating the record in the linked list and making
changes, with a linear complexity based on the number of records n.

Record filtering functions (filterStudent and filterTeacher) have a time complexity of O(nm),
where m is the average length of fields in the record. Both functions need to examine each
record to check if the keyword appears in different fields.

Lastly, checking student debt and teacher salary (checkDebt and checkSalary) also have a
time complexity of O(n). Both functions require traversing the linked list to find the specific
record.

Using this approach, we assess that all functions in the project code exhibit a time complexity
of O(n), where n is the number of input elements. With this design, the project has been
optimized for performance, enabling efficient handling of mass data and tasks.

11
5. TEST CASES
5.1 Check Login Of Admin

Input Expected Output Actual Output Status

Display notification Display notification


1. Enter account:
Invalid username or Invalid username or
admin Pass
password. password.
2. Enter password: a
Access denied. Access denied.

Display notification Display notification


1. Enter account:
Invalid username or Invalid username or
group1 Pass
password. password.
2. Enter password: 1
Access denied. Access denied.

1. Enter account: Display notification Display notification


data Invalid username or Invalid username or
Pass
2. Enter password: password. password.
g1 Access denied. Access denied.

Display notification Display notification


Press 1 to Manage Press 1 to Manage
1. Enter account:
Students Students
admin
Press 2 to Manage Press 2 to Manage Pass
2. Enter password:
Teachers Teachers
group
Press 3 to Exit Press 3 to Exit
Enter your choice: Enter your choice:

12
5.2 Insert a new record

Input Expected Output Actual Output Status

Student = {Student ID:1


Student Name: "Mike",
Student Course: "Math"
Student successfully Student
Student DOB: "19-06-2003" Pass
added. successfully added.
Student Address: "Ha Noi"
Unpaid Course Credits: 0

Student = {Student ID:1


Student Name: "Mike",
Student Course: "Math" ERROR: Invalid input
Student
Student DOB: "19-06-2003" for Unpaid Course Fail
successfully added.
Student Address: "Ha Noi" Credit
Unpaid Course Credits: -1

Student = {Student ID:v


Student Name: "Mike",
Student Course: "Math"
ERROR: Invalid input Bug: Fall into an
Student DOB: "19-06-2003" Fail
for Student ID endless loop
Student Address: "Ha Noi"
Unpaid Course Credits: 0

Student = {Student ID:1


Student Name: "2",
Student Course: "Math" ERROR:
Student
Student DOB: "19-06-2003" Invalid input for Fail
successfully added.
Student Address: "Ha Noi" Student Name
Unpaid Course Credits: 0

13
5.3 Check student’s debt function
Input Expected Output Actual Output Status

There is no student There is no student


List Empty Pass
record. record.

List with multiple node


containing Unpaid Credits: 1 Unpaid Credits: 1
Pass
Student IDs: 1,2,3,4 Debt: 1500000 VND Debt: 1500000 VND
Student ID: 1

List with multiple node


containing Student record not Student record not
Pass
Student IDs: 1,2,3,4 found. found.
Student ID: 5

List with multiple node


containing ERROR:Invalid input for Student record not
Fail
Student IDs: 1,2,3,4 Student ID found.
Student ID: -2

List with multiple node


containing ERROR:Invalid input for Bug: Fall into an
Fail
Student IDs: 1,2,3,4 Student ID endless loop
Student ID: n

5.4 Check teacher’s salary function


Input Expected Output Actual Output Status

There is no teacher There is no teacher


List empty Pass
record. record.

List with multiple node


Teacher record is Teacher record is not
containing Teacher IDs: 1,2,3,4 Pass
not found found
Teacher ID: 5

List with multiple node


Teacher's Salary: Teacher's Salary:
containing Teacher IDs: 1,2,3,4 Pass
5000000 5000000
Teacher ID: 1

1.Teacher record is not


List with multiple node ERROR: Invalid
found
containing Teacher IDs: 1,2,3,4 input for Teacher Fail
2.Fall into an endless
Teacher ID: n ID
loop

List with multiple node ERROR: Invalid


Teacher record is not
containing Teacher IDs: 1,2,3,4 input for Teacher Fail
found
TeacherID: -2 ID
14
5.5 Remove students function
Input Expected Output Actual Output Status

There is no student There is no student


Empty List Pass
record. record.

List with multiple node


Student removed Student removed
containing Student IDs: 1,2,3,4 Pass
successfully successfully
Student ID: 2

List with multiple node


Student record is not Student record is not
containing Student IDs: 1,2,3,4 Pass
found found
Student ID: 5

List with multiple node


ERROR: Invalid input Student record is not
containing Student IDs: 1,2,3,4 Fail
for Student ID found
Student ID: -2

List with one node containing


Student record is not Student record is not
Student ID: 1 Pass
found found
Student ID: 2

List with multiple node ERROR:


Bug: Fall into an
containing Student IDs: 1,2,3,4 Invalid input for Fail
endless loop
Student ID: n Student ID

5.6 Search students function


Input Expected Output Actual Output Status

There is no student There is no student


Empty List Pass
record. record.

ID:12 ID: 12
List with multiple node Name: john Name: john
containing Student Course: math Course: math
Pass
IDs: 12,3,4 Date Of Birth: 26-08 Date Of Birth: 26-08
Student ID: 12 Address: Thai Binh Address: Thai Binh
Unpaid Credits: 2 Unpaid Credits: 2

List with multiple node


containing Student ERROR: Invalid input for Bug: Fall into an
Fail
IDs: 1,2,3,4 Student ID endless loop
Student ID: n
15
5.7 Modify students record function

Input Expected Output Actual Output Status

List Empty There is no record There is no record Pass

List with one node Student's


data, Student ID: 1,
New data:
Updated successfully Updated successfully Pass
Name: John, Course: ThaiLand,
DOB: 26-05, Address: Ha Noi,
Unpaid Credits: 0

List with multiple nodes


containing Student record is not Student record is not
Pass
containing student's data, found found
Student ID: 3( not exist in the list)

List with one node Student's


data, Student ID: 1,
ERROR:
New data: Unpaid course credits
Invalid input for Fail
Name: John, Course: ThaiLand, updated successfully
Unpaid Course Credit
DOB: 26-05, Address: Ha Noi,
Unpaid Credits: -2

List with one node Student's


data, Student ID: 1,
New data: ERROR:
Bug: Fall into an
Name: John, Course: ThaiLand, Invalid input for Fail
endless loop
DOB: 26-05, Address: Ha Noi, Unpaid Course Credit
Unpaid Credits: "two"

16
5.8 Filter function
Input Expected Output Actual Output Status

List Empty There is no record There is no record Pass

ID: 12 ID: 12
List with multiple node Name: john Name: john
containing Course: math Course: math
Pass
Student IDs: 12,3,4 Date Of Birth: 26-08 Date Of Birth: 26-08
Keyword to search: 12 Address: Thai Binh Address: Thai Binh
Unpaid Credits: 2 Unpaid Credits: 2

ID: 4 ID: 4
List with multiple node
Name: Lisa Name: Lisa
containing
Course: Computer Course: Computer
Student name: "Mike, Pass
Date Of Birth: 25-09 Date Of Birth: 25-09
John, Lisa"
Address: Ha Noi Address: Ha Noi
Keyword to search: Lisa
Unpaid Credits: 0 Unpaid Credits: 0

List with multiple node


containing Student's
No Output No Output Pass
information
Keyword to search: "not"

17
WORK BREAKDOWN STRUCTURE

Name Contribution %

Update
Nguyen Hoang Anh function 20
Main function

Slide
Ha Thi Hong Anh Remove 20
function

Report
Nguyen Bich Diep 20
Add function

Search function
Tran Viet Dung 20
Filter function

Test case
Nguyen Quang Phuc Check 20
debt/salary

18

You might also like