Problem Statement In this Problem, you have to write anapplication in Python that keeps track of…

Problem Statement In this Problem, you have to write anapplication in Python that keeps track of traffic fines. Allviolations are noted by a traffic policeman in a file as a record .At the end of each day, files from all traffic policemen arecollated. If a driver had been charged with more than threeviolations so far, then he has to be booked for further legalaction. Also, the police department provides additional bonus tothose policemen who have brought in large fine earnings. Allpolicemen who have collected equal to or more than 90% of thehighest total fine collected by an individual policeman, shall beawarded the bonus. The program should help the police departmentanswer the below queries: 1. Find out the drivers who are bookedfor legal action: All such license numbers are to be output in afile called “violators.txt”. 2. Find out the policemen who areeligible for bonus: The list of policemen eligible for bonus mustbe output in a file called “bonus.txt”. Additionally, 3. Perform ananalysis of questions 1 and 2 and give the running time in terms ofinput size, n. Use hash tables for keeping track of drivers (andtheir violations), and a binary tree for keeping track of policemen(and their bookings). Data structures to be used: DriverHash: Aseparately chained hash table indexed by license numbers where eachentry is of the form < license number, number of violations>.A simple hash function h(x) = x mod M, where M is the size of hashtable can be used for this. PoliceTree: This is a Binary Tree ofentries of the form The basic structure of the Police Node will be:Functions: 1. def initializeHash (self): This function creates anempty hash table that points to null. 2. def insertHash(driverhash, lic): This function inserts the licence number lic tothe hash table. If a driver’s license number is already present,only the number of violations need to be updated else a new entryhas to be created. 3. def printViolators (driverhash): Thisfunction prints the serious violators by looking through all hashtable entries and printing the license numbers of the drivers whohave more than 3 violations onto the file violators.txt. The outputshould be in the format ————–Violators————- , noof violations 4. def destroyHash (driverhash): This functiondestroys all the entries inside the hash table. This is a clean-upcode. 5. def insertByPoliceId (policeRoot, policeId, amount): Thisfunction inserts an entry into the police tree ordered by policeid. If the Police id is already found in the tree, then thisfunction adds up to the existing amount to get the total amountcollected by him. This function returns the updated tree. 6. defreorderByFineAmount (policeRoot): This function reorders the BinaryTree on the basis of total fine amount, instead of police id. Thisfunction removes the nodes from the original PoliceTree, and putsit in a new tree ordered by fine amount. Note that if the fineamount in node i is equal to the amount in node j, then the node iwill be inserted to the left of the node j. This function returnsthe root node of the new tree. 7. def printBonusPolicemen(policeRoot): This function prints the list of police ids whichhave earned equal to or more than 90% of maximum total fine amountcollected by an individual. The output is pushed to a file calledbonus.txt. The output will be in the format ————– Bonus————- , no of violations 8. def destroyPoliceTree(policeRoot): This function is a clean-up function that destroysall the nodes in the police tree. 9. def printPoliceTree(policeRoot): This function is meant for debugging purposes. Thisfunction prints the contents of the PoliceTree in-order. 2. Samplefile formats Sample Input file Every row of the input file shouldcontain the / / in the same sequence. Save the input file asinputPS3.txt Sample inputPS3.txt 111 / 1231114 / 100 111 / 1214413/ 200 222 / 1231412 / 100 222 / 1231114 / 100 333 / 1231114 / 100Sample violators.txt ————–Violators————- 1231114,3 Sample bonus.txt ————–Violators————- 111, 300222, 100 3. Deliverables a. Zipped PS3_TF_[Group id].py packagefolder containing modules and package files for the entire programcode and associated functions b. inputPS3.txt file used for testingc. bonus.txt containing the list of policemen ids who are eligiblefor a bonus. d. violators.txt: containing the list of drivinglicence numbers against which legal action is required. e.analysisPS3.txt file containing the running time analysis for theprogram. 4. Instructions a. It is compulsory to make use of thedata structure/s mentioned in the problem statement. b. It iscompulsory to use Python for implementation. c. Ensure that alldata structure insert and delete operations throw appropriatemessages when their capacity is empty or full. d. For the purposesof testing, you may implement some functions to print the datastructures or other test data. But all such functions must becommented before submission. e. Make sure that your read,understand, and follow all the instructions f. Ensure that theinput, prompt and output file guidelines are adhered to. Deviationsfrom the mentioned formats will not be entertained. g. Run timeanalysis is provided in asymptotic notations and not timestampbased runtimes in sec or milliseconds. 5. Deadline a. The strictdeadline for submission of the assignment is 6th July, 2019. b. Thedeadline is set for a month from the date of rollout to accommodatefor the semester exams. No further extension of the deadline willbe entertained. c. Late submissions will not be evaluated. 6. Howto submit a. This is a group assignment. b. Each group has to makeone submission (only one, no resubmission) of solutions. c. Eachgroup should zip the deliverables and name the zipped file as below“ASSIGNMENT1_[BLR/HYD/DLH/PUN/CHE]_[B1/B2/…]_[G1/G2/…].zip” andupload in CANVAS in respective location under ASSIGNMENT Tab. d.Assignment submitted via means other than through CANVAS will notbe graded. 7. Evaluation a. The assignment carries 13 Marks. b.Grading will depend on a. Fully executable code with allfunctionality b. Well-structured and commented code c. Accuracy ofthe run time analysis c. Every bug in the functionality will havenegative marking. d. Source code files which contain compilationerrors will get at most 25% of the value of that question. 8.Readings Section 2.3,2.5,3.1: Algorithms Design: Foundations,Analysis and Internet Examples Michael T. Goodrich, RobertoTamassia, 2006, Wiley (Students Edition)

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-8hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now

Do you have an upcoming essay or assignment due?

All of our assignments are originally produced, unique, and free of plagiarism.

If yes Order Paper Now