You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a linear search for an item in a sequence that may be unsorted.
Implement a linear search in a sorted (non-decreasing) sequence.
Implement a recursive binary search in a non-decreasing sequence. You may copy the code in Section 13.4.2 of the M269 book.
Implement an iterative binary search. You may copy the code in Section 13.4.3 of the M269 book.
The functions, except the first one, should raise ValueError if the sequence isn't non-decreasing.
Create a file tests/test_search.py that is similar to sorting.py:
Create two constant lists, one of sorted sequences and another of unsorted sequences.
Write a fixture sorted_sequence that returns one of the sorted sequences and a fixture any_sequence that returns either a sorted or unsorted sequence.
Write a fixture search_sorted that returns a search function that works on sorted sequences and a fixture search_any that returns a search function that works on any sequence.
Write two test functions: one applies search_sorted to sorted_sequence, the other applies search_any to any_sequence.
The text was updated successfully, but these errors were encountered:
Create a file
paddles/search.py
:ValueError
if the sequence isn't non-decreasing.Create a file
tests/test_search.py
that is similar tosorting.py
:sorted_sequence
that returns one of the sorted sequences and a fixtureany_sequence
that returns either a sorted or unsorted sequence.search_sorted
that returns a search function that works on sorted sequences and a fixturesearch_any
that returns a search function that works on any sequence.search_sorted
tosorted_sequence
, the other appliessearch_any
toany_sequence
.The text was updated successfully, but these errors were encountered: