Question: 5. 20 points] Write a Python function fixed_dist that takes two lists a and b, each of which is sorted in non-decreasing order, and takes
![5. 20 points] Write a Python function fixed_dist that takes two](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66c22cea229b3_51366c22ce9abdf4.jpg)
5. 20 points] Write a Python function fixed_dist that takes two lists a and b, each of which is sorted in non-decreasing order, and takes a number d, and returns a pair of val- ues (ali], blj]) such that al1] bIj]d, or returns None if no such pair exists. It should run in time O(n) where n sum of the lengths of the two lists. For example, fixed dist(C1, 6, 14, 22, 29], [3, 10, 13, 17, 19, 21], 5) should return (22, 17)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
