Page 1 of 1

Question 2: (30 Marks) In a central train station, the arrival and waiting time of trains is given. Whenever any train a

Posted: Fri Jul 08, 2022 6:38 am
by answerhappygod
Question 2 30 Marks In A Central Train Station The Arrival And Waiting Time Of Trains Is Given Whenever Any Train A 1
Question 2 30 Marks In A Central Train Station The Arrival And Waiting Time Of Trains Is Given Whenever Any Train A 1 (172.82 KiB) Viewed 51 times
please, i want solution
Question 2 30 Marks In A Central Train Station The Arrival And Waiting Time Of Trains Is Given Whenever Any Train A 2
Question 2 30 Marks In A Central Train Station The Arrival And Waiting Time Of Trains Is Given Whenever Any Train A 2 (130.26 KiB) Viewed 51 times
Question 2: (30 Marks) In a central train station, the arrival and waiting time of trains is given. Whenever any train arrives to the station, it usually stops at a given platform to enable the passengers to get-off/on the train. From economical perspective, it is always requested to find the minimum number of platforms needed to avoid delaying any train. The following table contains the arrivals and waiting times of the trains: Input: Arrival Waiting time in minutes 10:00 10 10:40 140 Photo: Peet Simard/Corbis ... Gare du Nord, Paris 10:50 90 12:00 30 16:00 240 Page 2 of 4 Output: 3 platforms [Note: the output 3 platforms is based on the fact that there are at the most three trains at a time (this will happen between 12:00 to 12:20)] a) Explain how a brute force algorithm would solve this problem and analyze its complexity. (3+2 marks) 19:00 120 b) Design a more efficient algorithm to solve this problem (6 marks), and analyze its complexity (3 marks) [Important instruction: Create an arbitrary list of 6 arrivals and their corresponding departures to provide full explanation of how your proposed algorithm should work step by step] (6 marks) c) Implement your efficient algorithm using Python (10 marks)
Question 1: (35 marks) You are given a list of unique randomly arranged characters, for example (R, Q, H, F, Y, G). The quadruple (R, Q, H, F) is called in inversion quadruple because (F<H<Q<R) in terms of value, while the index of F in the list is greater than the index of H, the index of H is greater than Q, and the index of q is greater than R. Therefore, we can find 2 inversions in such list as follows: (R, Q, H, F), and (R, Q, H, G). Your main mission is to find the total number of inversions in any given list. a) Design a brute-force algorithm to return the number of possible inversions, and analyse the complexity of your solution (5 marks) b) Develop a python code to implement your brute-force algorithm. (10 marks) [The marks depend on the correctness of the code, indentation, comments, test-case] c) Design a more efficient algorithm to do the same task with less complexity, and analyse the complexity of your solution. (15 marks) [Important instruction to be followed: Create an arbitrary unsorted list of 8 characters and use it to provide full explanation of how your proposed algorithm should work step by step] d) Prepare a brief report (250 words) comparing the two algorithms (5 marks)