Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C programming Google Flight is a ticket flight metasearch system that can compare multiple of flight tickets from other air flight companies. However, Google Flight
C programming
Google Flight is a ticket flight metasearch system that can compare multiple of flight tickets from other air flight companies. However, Google Flight received a complaint from the customer that the searching function was very slow. As a newly appointed programmer, you are required to improve the Google Flight system to make it more efficient and faster. Table 1 shows the example of one-way ticket flight search results from Kuala Lumpur to Kota Kinabalu. Table 1: Search results from Kuala Lumpur to Kota Kinabalu Air Flight Departure Time Price (RM) Malindo 18:10 - 20:40 158 Malindo 14:45-17:15 187 MAS 12:20 - 17:05 414 Malindo 09:10 - 11:40 150 Royal Brunei 12:10 - 17:05 368 MAS 17:50 - 20:35 307 a) Initially, prices for the entire ticket flights are unsorted. The scarching process more efficient when the list is arranged according to the prices. i. Develop a function sort Func(int list[], int length) to arrange the prices from cheapest to expensive using bubble sort algorithm where parameter list ( )is prices and length is the number of ticket flight. (5 Marks) ii. From the sorted list produced using the algorithm in a(i), analyse the sorting algorithm by illustrating the bubble sort processing cycle. (10 Marks) b) Construct a function binarySearch(int list(), int length, int searchItem) to search a budget within RM187 or less. Then, display all the corresponding prices. (10 Marks) Google Flight is a ticket flight metasearch system that can compare multiple of flight tickets from other air flight companies. However, Google Flight received a complaint from the customer that the searching function was very slow. As a newly appointed programmer, you are required to improve the Google Flight system to make it more efficient and faster. Table 1 shows the example of one-way ticket flight search results from Kuala Lumpur to Kota Kinabalu. Table 1: Search results from Kuala Lumpur to Kota Kinabalu Air Flight Departure Time Price (RM) Malindo 18:10 - 20:40 158 Malindo 14:45-17:15 187 MAS 12:20 - 17:05 414 Malindo 09:10 - 11:40 150 Royal Brunei 12:10 - 17:05 368 MAS 17:50 - 20:35 307 a) Initially, prices for the entire ticket flights are unsorted. The scarching process more efficient when the list is arranged according to the prices. i. Develop a function sort Func(int list[], int length) to arrange the prices from cheapest to expensive using bubble sort algorithm where parameter list ( )is prices and length is the number of ticket flight. (5 Marks) ii. From the sorted list produced using the algorithm in a(i), analyse the sorting algorithm by illustrating the bubble sort processing cycle. (10 Marks) b) Construct a function binarySearch(int list(), int length, int searchItem) to search a budget within RM187 or less. Then, display all the corresponding prices. (10 Marks)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