Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem description Ever since the return from the pandemic after Covid-19, the lecturers from a prestigious university have noticed that the students have boosted their
Problem description
Ever since the return from the pandemic after Covid-19, the lecturers from a prestigious university have noticed that the students have boosted their cheating game in exams by planning beforehand with the students sitting in front and behind them. Hence, the lecturers have decided to create a new alphabetically sorted seating arrangement for each exam and only showing the arrangement 5 minutes before the exam. It is important to note that the number of students in a class is never fixed, and each exam has different students taking it. Which also means that each time for an exam, students can be removed or added from one exam to another and only release these names before each exam.
In this way, the students would not know who is sitting in front of them or behind them before an exam; which reduces the chances of them planning their cheating process beforehand. However, the students are trying to outsmart the algorithm and determine how they can find the names quickly so they can strategize their cheating mechanism.
Problem breakdown
Consider a list of students where each student in the list has information (such as Name, ID, Major) assuming that the students name is unique (no duplicates). Note that, you need to implement your own Student class. Your task is to implement a program that helps a given student to find the students X and Y, where X would be the student information behind the given student and Y is the information of the student in front of the given student considering that the students are seated in alphabetical order. This could be done very quickly as the students have limited time to figure out the arrangement and strategize before starting the exam.
You are asked to implement this project twice, each with a different data structure in order to easily find out the names of students sitting before and after a given student in a test. One of your implementations must allow a list insertion and deletion of complexity of O(logn) in the general scenarios. Also, its worth noting that the complexity of best sorting algorithm is O(n logn).
Your testing program must have a menu with three options:
1. Add a student to the list. In this option, the user should enter the student information and
add it to the list.
2. Remove student from the list given his/her name. In this option, the user will enter the
students name and it will get deleted from the list.
3. Find front and back students of a given student. In this option, the user will enter the
name of a student, then the information of the students in front and back of the given
students will be displayed on the screen.
4. Exit
Please write the code in java for this application.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started