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

DataStructure FALL 2024 Assignment3

Uploaded by

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

DataStructure FALL 2024 Assignment3

Uploaded by

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

FAST NUCES CS218: Data Structures (Fall 2024)

Assignment #03

Gamers Database Manager

1 Objective
You have been provided a data set of Players and the games they play. Each player
will have his own primary key (Player ID) and each game will have its own primary
key (Game ID) to identify the different games and players. Your Boss needs a database
management system that he can use on console to filter out certain queries that he told
you beforehand will be needed by the company.
To ensure the code has version control, the Boss has asked you to use GitHub while
making this project, as well as creating a Readme.md where you report on how you made
the project, your thought process and logic behind each task, and the time complexity
of each task in your code. Make sure to commit work regularly as it may be checked
whether the commits were meaningful or just tactics.
Note: Some of the tasks are prerequisites to the latter tasks, so any problems in
the implementation of such a task may cause issues for other tasks. Therefore, ensure
each task is completed carefully to avoid any conflicts. Optimize your code in terms of
time and complexity. The code should be dynamic; any sign of hardcoded tasks where
dynamic solutions should be used will be penalized. Additionally, the code should be
written in a way that it can be modified for future use and improvements. Comments
should be added to the code, but only where necessary, explaining the logic behind the
workings rather than generic comments.

1.1 Store the dataset in Memory


You will be provided CSV files for the players’ and games’ dataset. Your job is to store
the data in memory using appropriate data structures (Binary Search Tree) to save time
in insertion, search, and deletion of data.
Before starting, you must first generate a number ’seed,’ which will be your batch and
roll number. For example, if your roll number is 21i0784, it would become 210784. This
seed will be used to generate the random variable for your code.
With this seed, you will choose to skip lines while reading the dataset for play-
ers. You will generate a random number from 0 to 1000. If the number is less than
(last 2 digits of your roll number × 10 + 100), skip the line; otherwise, read the line and
add the node to your DBMS in memory.
The data stored in memory will be a Node of a tree, and for each Node, you must
follow the format to avoid conflicts with future queries. Using this, there should be no
query conflicts for future tasks.
FAST NUCES CS218: Data Structures (Fall 2024)
Assignment #03

Figure 1: Appropriate Format

1.2 Insertion
The system should allow insertion into the dataset for both players and games in their
appropriate data structures. The insertion query must check for conflicts, and display an
error if the primary key of the object being inserted already exists.

1.3 Search and Retrieval


The DBMS should be able to search for entries based on the primary key and return the
corresponding node to the user for viewing or modification.

1.4 Deletion
The system should allow the deletion of any entry from memory and ensure no memory
leaks occur as a result.
FAST NUCES CS218: Data Structures (Fall 2024)
Assignment #03

1.5 Save Data


The DBMS should be able to save the data from memory to a CSV file using Preorder
Traversal to ensure the same tree structure is restored when the program is restarted.

Figure 2: Preorder Traversal Example Output

1.6 Show N Layers


The system should show all entries up to N layers as they would appear in a binary search
tree. If N exceeds the number of layers present, it should print to the last layer and show
a warning: "Layer Limit was Reached, can’t go further".

1.7 Show Layer Number


The system should allow the user to input a primary key and return the layer number of
the corresponding node in the tree.

1.8 Show Path


The DBMS should print the Preorder Traversal path taken to find an entry.
FAST NUCES CS218: Data Structures (Fall 2024)
Assignment #03

1.9 Edit Entry


The system should allow the editing of any entry, including the primary key. After
editing, the node should be repositioned in the tree if needed.

1.10 Top N Players


The system should find the top N players who play the most games in the dataset.

1.11 Show Details


The DBMS should allow the search of a player and display the details of the player, along
with the details of all the games the player has played.

1.12 Has Played


The system should be able to search in a time complexity of at most 2 log(n) to determine
whether a player has played a specific game. The search should take Player ID and Game
ID as input, and the workings should demonstrate how the time complexity satisfies the
requirement.

2 Submission Criteria and Guidelines


• Submit your code in a single zip file named DEPARTMENT SECTION Assignment ROLLNUMBER
(e.g., DS A A3 i211354.zip). The zip file should contain two files:

– DS A A3 i211354.cpp (your code)


– readme.md (your README file) for GitHub.

• Use classes for your solution. No marks will be awarded for code that does not
use object-oriented programming principles.

• Do not use STL, strings, arrays, or any built-in functions or libraries.

• Zero marks will be given for code that crashes (e.g., segmentation fault) or cannot
compile due to syntax errors.

• Plagiarism will result in zero marks for both parties involved. Copying from the
internet is strictly prohibited.

• You are not allowed to use LLMs for code generation; however, you can use them
for learning. If you do so, you must remember the prompts for the demo day.

• Deadline: October 30, 2024, 11:59 PM. Late submissions will not be accepted.

You might also like