Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function get_max_overlap(events) that returns the two events in the events table(below) with the maximum overlap and their overlap time. Note that it does

Write a function get_max_overlap(events) that returns the two events in the events table(below) with the maximum overlap and their overlap time. Note that it does NOT have to be consecutive events. If there is more than one occurrence of the maximum overlap time, the function should return the details of the first occurrence. If none of the given events overlaps the function should return None.

events = [['A',0,3],['B',4,6],['C',8,14],['D',9,11],['E',10,16],['F',12,18]]

The helper function, get_overLap( event, event2) is provided to you (see below). You may use this function in your implementation of the get_max_overlap(events) function.

image text in transcribedimage text in transcribed

def get overlap (event1, event2): ""\| Inputs: two overlapping events, where event1 starts before event2 Output: overlap time between the two events "\|" if event2 [2] return event2 [2] - event2 [1] else: return (event2 [2]-event1 [1])-(event2 [1]-event1 [1]) - (event2 [2]-event1 [2])

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

Name is needed for identifying organisms ?

Answered: 1 week ago