Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in python i For this task, you may assume that all Double Key Table and all Infinite Hash Table methods are O(1), even if

code in python

For this task, you may assume that all Double Key Table and all Infinite Hash Table methods are O(1), even if they obviously \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|} \hline Name & \( \mathrm{m} 1 \) & \( \mathrm{~m} 2 \) & \( \mathrm{~m} 3 \) & \( \m   

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:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Management for Public Health and Not for Profit Organizations

Authors: Steven A. Finkler, Thad Calabrese

4th edition

133060411, 132805669, 9780133060416, 978-0132805667

More Books

Students also viewed these Programming questions

Question

=+Describe the components of this time series.

Answered: 1 week ago

Question

What are marginal costs?

Answered: 1 week ago

Question

What are some common types of funds?

Answered: 1 week ago