Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Note: This above is the one full Question Part 1: Algorithms (20 marks) A transport consultant has created a file of information about trips collected
Note: This above is the one full Question
Part 1: Algorithms (20 marks) A transport consultant has created a file of information about trips collected from individuals who have participated in a survey. This information includes start_time and end time variables, One of the items contained in the file is the duration of each trip (that is, end time - start_time) in minutes. The consultant is trying to work out how to calculate the number of trips with duration greater than 60 minutes (that is, how many trips take longer than an hour) and requires your assistance to develop an algorithm. You can assume that the durations are read one at a time and should only be read until EOF (end of file) is reached a) i. 5 marks] Develop a flowchart to show your algorithm, using the diagrammatic conventions described in the lecture notes/slides. ii. [6 marks] Translate your flowchart into pseudocode, following the conventions described in the lecture notes/slides The remainder of part 1 deals with the following pseudocode procedure mystery: start read n read list xi, x2, X3, .- Xn myvar x myvarxi end if end do end do stop b) 2 marks] Noting any assumptions on your part, what does this procedure do? Explain succinctly (that is, do not explain the pseudocode line by line) in no more than three well-written sentences c) 1 mark] Using big O notation, what is the likely complexity of this algorithm? d) 22 2 6 marks] . Taking into account what the algorithm should do, write an improved version of this algorithm in pseudocode Briefly describe your changes using dot points. Provide the likely complexity of the improved version using big O notation (note it can stay the same, but should not get worse) ii. iii. Part 1: Algorithms (20 marks) A transport consultant has created a file of information about trips collected from individuals who have participated in a survey. This information includes start_time and end time variables, One of the items contained in the file is the duration of each trip (that is, end time - start_time) in minutes. The consultant is trying to work out how to calculate the number of trips with duration greater than 60 minutes (that is, how many trips take longer than an hour) and requires your assistance to develop an algorithm. You can assume that the durations are read one at a time and should only be read until EOF (end of file) is reached a) i. 5 marks] Develop a flowchart to show your algorithm, using the diagrammatic conventions described in the lecture notes/slides. ii. [6 marks] Translate your flowchart into pseudocode, following the conventions described in the lecture notes/slides The remainder of part 1 deals with the following pseudocode procedure mystery: start read n read list xi, x2, X3, .- Xn myvar x myvarxi end if end do end do stop b) 2 marks] Noting any assumptions on your part, what does this procedure do? Explain succinctly (that is, do not explain the pseudocode line by line) in no more than three well-written sentences c) 1 mark] Using big O notation, what is the likely complexity of this algorithm? d) 22 2 6 marks] . Taking into account what the algorithm should do, write an improved version of this algorithm in pseudocode Briefly describe your changes using dot points. Provide the likely complexity of the improved version using big O notation (note it can stay the same, but should not get worse)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