code in python i For this task, you may assume that all Double Key Table and all
Fantastic news! We've Found the answer you've been seeking!
Question:
code in python
Transcribed Image Text:
i For this task, you may assume that all Double Key Table and all Infinite Hash Table methods are O(1), even if they obviously are not. Also note you're welcome to edit and add additional functionality to mountain.py In this task, you'll be working on: mountain_organiser.py As you embark on your Mountain Climbing journey, you find that as time passes, the number of mountains you can climb increases. For the first week, maybe you can only do low-altitude, non-steep mountains, and as time goes on, you can climb more and more difficult mountains. As you climb more and more mountains, you'd like to know the rank of each mountain, if all the mountains you've seen are ranked by their difficulty increasing. In cases where the difficulty is the same, you should order them by name lexicographically increasing (you can assume this is unique) To achieve this, we'd like you to implement the MountainOrganiser class (in mountain_organiser.py), which requires 3 methods: __init__ Initialisation add_mountains (self, mountains: list [Mountain]) -> None: Adds a list of mountains to the organiser cur_position(self, mountain: Mountain) -> int : Finds the rank of the provided mountain given all mountains included so far. See below for an example. Raises KeyError if this mountain hasn't been added yet. i Complexity Requirement add_mountains should have complexity at most O(M log(M) + N), where M is the length of the input list, and N is the total number of mountains included so far. cur_position should have complexity at most O(log(N)), where N is the total number of mountains included so far. Consider the following example: i For this task, you may assume that all Double Key Table and all Infinite Hash Table methods are O(1), even if they obviously are not. Also note you're welcome to edit and add additional functionality to mountain.py In this task, you'll be working on: mountain_organiser.py As you embark on your Mountain Climbing journey, you find that as time passes, the number of mountains you can climb increases. For the first week, maybe you can only do low-altitude, non-steep mountains, and as time goes on, you can climb more and more difficult mountains. As you climb more and more mountains, you'd like to know the rank of each mountain, if all the mountains you've seen are ranked by their difficulty increasing. In cases where the difficulty is the same, you should order them by name lexicographically increasing (you can assume this is unique) To achieve this, we'd like you to implement the MountainOrganiser class (in mountain_organiser.py), which requires 3 methods: __init__ Initialisation add_mountains (self, mountains: list [Mountain]) -> None: Adds a list of mountains to the organiser cur_position(self, mountain: Mountain) -> int : Finds the rank of the provided mountain given all mountains included so far. See below for an example. Raises KeyError if this mountain hasn't been added yet. i Complexity Requirement add_mountains should have complexity at most O(M log(M) + N), where M is the length of the input list, and N is the total number of mountains included so far. cur_position should have complexity at most O(log(N)), where N is the total number of mountains included so far. Consider the following example:
Expert Answer:
Related Book For
Financial Management for Public Health and Not for Profit Organizations
ISBN: 978-0132805667
4th edition
Authors: Steven A. Finkler, Thad Calabrese
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Metro builds and operates traditional shopping malls. It holds a $25 million deferred tax asset relating to credit carryforwards at the state, local, and Federal levels. No valuation allowances...
-
Let R be a ring with unity u. Prove that the units of R form a group under the multiplication of the ring.
-
A company produces 128,000 cases of soft drink annually. It costs $1 to store 1 case for 1 year and $10 to produce 1 lot. Find the number of lots that should be produced annually.
-
A person donates a bag of clothes to Goodwill completely unaware that there is valuable sterling silver in the bag. The clothing and silver are subsequently sold, for a very economical price, to...
-
(EPS: Simple Capital Structure) On January 1, 2010, Chang Corp. had 480,000 shares of common stock outstanding. During 2010, it had the following transactions that affected the common stock account....
-
Mary, Shannon, and Anika invested $60,000, $75,000, and $105,000, respectively, to start an e-learning business. They realized that they required an additional $22,800 for operating the business. How...
-
Type "United Airlines Fiasco" into Google and describe what results you see on the first page. Identify and explain in your own words the reputational damage the company faced back in April 2017.
-
List three processes that can be used to identify and review profits and losses from a profit and loss statement. Explain the concept of financial probity and its importance to a business. List four...
-
#6 of 13 Joe Wilkes earns $4,000 per month as a salaried nonexempt employee. He worked 22 hours of overtime this month. Joe's gross salary for the month is a. $6,031.25 Ob. $4,230.37 Oc. $4,761.64...
-
A woman opens a 1.05 m wide door by pushing on it with a force of 33.5 N directed perpendicular to its surface. HINT (a) What magnitude torque (in N m) does she apply about an axis through the hinges...
-
Reiterate the problem and the root cause you are going to try to tackle for this assignment. Incorporate any feedback you received on assignment 3. Brainstorm possible changes you can make to address...
-
Tailoring- determining the appropriate combination of processes, inputs, tools, techniques, outputs and life cycle phases to manage processes is referred to as "tailoring" These are the four...
-
Given that traditional U.S. firms such as IBM have more than 70% of their employees and almost two-thirds of their revenues come from outside the United States, what is an appropriate definition of a...
-
Tiger, Inc. signed a lease for equipment on July 1, 2007.The lease is for 10 years (the useful life of the asset).The first of 10 equal annual payments of $500,000 was made on July 1, 2007.The...
-
To explore how student project groups develop through various stages. INSTRUCTIONS 1. Think about the last time you were assigned to a student group to complete a course-related project. 2. Next,...
-
To explore which conflict styles students would use in a variety of workplace scenarios. INSTRUCTIONS 1. Read each of the following workplace scenarios. 2. Next, choose the conflict style being used...
-
The chapter included a paragraph on restaurant managers and staff communication about COVID-19 policies and practices. What would constitute transparency in the downward and upward directions? Data...
Study smarter with the SolutionInn App