EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
热门代写
您的位置: 主页 > 写作技巧 > 热门代写 >
computer programs代写,hash table代写
发布时间:2021-03-06 20:22:44浏览次数:
 Your tasks
[15pts] Mr ParkingPls is convinced that to find the time index with the most overlapping lecture sessions, one
computer programs代写,hash table代写

only needs to find overlaps between time indices at the beginning or end of the intervals, rather the entire time index. The question is:
(a)[5 pts] Is Mr ParkingPlscorrect?
(b)[10pts] If Mr ParkingPls is correct, please support your answer with a  Otherwise, please provide a counter-example.computer programs代写
2.[45 pts] Since Mr ParkingPls would like to use this work for other much larger projects where new sessions can be added quite often, Mr ParkingPls would like to use Red-Black Tree and asked your help.
To help him, please:
(a)[10 pts] Design a suitable Red-Black Tree data structure for Mr ParkingPls’ problem. This means that givena Red-Black Tree implementation as defined in [CLRS]  13, how you would use/augment/modifythis underlying data structure for Mr ParkingPls problem. Hint: You might want to read [CLRS] sec. 14.3 first (provided as additional resources to this assignment).
(b)[5 pts] Please provide an algorithm with (log n) complexity for inserting a node to the tree you have designedin 2a, along with the derivation of its complexity  The notation n refers to the number ofnodes that are already in the tree prior to insertion. For the algorithm, you can use the insertion procedure of Red-Black Tree in [CLRS] ch. 13 as a basis and stated only the modifications needed, if alterations are needed. If no alteration is needed, please explain why.computer programs代写
(c)[15 pts] Please provide an algorithm for finding the time index with the largest number of overlapping lecture sessions in the red-black tree you designed. Please also provide the correctness proof (using loop invariant) and the time complexity (with its derivation) of your algorithms. You will get full mark if the time complexity of your algorithm is O(1) and at most 9 points if the time complexity of your algorithmisO(log n), where n is the number of lecture sessions.
 Please note that in this question:computer programs代写
You can only use red-black tree datastructure
You need to assume that the maximum time index is a variable (i.e., the complexity requirement should still hold if the maximum time index is a variable k, which is given as input, rather than 145) because, Mr ParkingPls would like to use the algorithm for other parking issues
(d)[15 pts] Please implement the above solution such that the user can find the time index by giving the command “A2[studentID] input file name” OR “java A2[studentID] input file name” from thecommand prompt. The input format is described in the next section. We provide you with a main.cpp and a scaf- folding for Red-Black  If you use C/C++, you need to implement the node insertion function and the algorithm you provided in 2c on top of the provided main function and Red-Black Tree scaffolding.computer programs代写
If you use java, you need to make sure that your java program accepts the same input as the provided main.cpp .
You also need to develop Red-Black Tree yourself. If you choose this path, you might want to first check which operations of Red-Black Tree you need for this assignment and implement only those operations. Note: You are not allowed to use TreeMap or other Java Red-Black Tree library.
Program Marking: If your program compiles and runs, you will get 3 points. We will then run your program on 6 test cases: 2 cases would have up to 5,000 sessions, 2 cases would have 5,001 – 500,000 sessions, and 2 cases would have 500,001 – 5,000,000 sessions. For each test case, your program will be given a total of (log n + 0.01)sec CPU time to find a solution. computer programs代写
This time limit includes the time for reading the file, inserting the data to the red-black tree, finding the solution, and printing the solution. The time limit will be rounded up to 2 decimal digit. You can assume your program will have access to at most 12GB RAM. It will be run as a single thread process on a computer with Intel i7 3.4GHz processor. For each test case that your program solves correctly within the given time and memory limit, you will get 2 points.
Examples of the test cases are available in
Input to the Program computer programs代写
The program will accept a single argument, which is the name of the input file. The input file contains N + 1 lines, where N is the number of lecture session intervals.
The first line consists of a single number, which is N.
Each line in the next N lines consists of three numbers, separated by a white space. The first number is the session ID, the second number is starting time index, and the third number is the ending time index.
The session ID is sorted, in the sense that ID-i would be in line-(i + 1).