Write a Python program named "Mountain Explorer.py" that begins by defining and initializing an array of 25 floating-point numbers representing the heights of different mountains. The array values are as follows: 8848.86, 8611.12, 8192.04, 7890.98, 7546.23, 7310.55, 7101.98, 6907.23, 6685.91, 6476.23, 6221.98, 6088.55, 5896.32, 5631.21, 5410.75, 5222.33, 5084.56, 4924.43, 4750.23, 4592.13, 4421.77, 4268.23, 4124.89, 3982.65.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Don't try to replicate someone else's work or use an AI platform to generate an answer. If I see these things, I'll definitely downvote you and report you.
Write a Python program named "Mountain Explorer.py" that begins by defining and
initializing an array of 25 floating-point numbers representing the heights of different
mountains. The array values are as follows: 8848.86, 8611.12, 8192.04, 7890.98,
7546.23, 7310.55, 7101.98, 6907.23, 6685.91, 6476.23, 6221.98, 6088.55, 5896.32,
5631.21, 5410.75, 5222.33, 5084.56, 4924.43, 4750.23, 4592.13, 4421.77, 4268.23,
4124.89, 3982.65.
(a) Prompt the user for a target value (Key) representing a mountain height. Pass the
value, the array, and the size of the array to a function that implements the linear or
sequential search algorithm. This function should count the number of comparisons
until it finds the value and return the count to the main function.
(b) Call a function that uses the merge sort algorithm to sort the given array.
(c) Call a function that uses the binary search algorithm to locate the same target value
(Key). Pass the value, the sorted array, and the size of the array to this function. The
function should keep track of the number of comparisons and return this count to the
main function. Display the number of comparisons for both search functions in the
main with appropriate messages.
Transcribed Image Text:Write a Python program named "Mountain Explorer.py" that begins by defining and initializing an array of 25 floating-point numbers representing the heights of different mountains. The array values are as follows: 8848.86, 8611.12, 8192.04, 7890.98, 7546.23, 7310.55, 7101.98, 6907.23, 6685.91, 6476.23, 6221.98, 6088.55, 5896.32, 5631.21, 5410.75, 5222.33, 5084.56, 4924.43, 4750.23, 4592.13, 4421.77, 4268.23, 4124.89, 3982.65. (a) Prompt the user for a target value (Key) representing a mountain height. Pass the value, the array, and the size of the array to a function that implements the linear or sequential search algorithm. This function should count the number of comparisons until it finds the value and return the count to the main function. (b) Call a function that uses the merge sort algorithm to sort the given array. (c) Call a function that uses the binary search algorithm to locate the same target value (Key). Pass the value, the sorted array, and the size of the array to this function. The function should keep track of the number of comparisons and return this count to the main function. Display the number of comparisons for both search functions in the main with appropriate messages.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education