401 data structures and algorithms code challenges
PythonEach type of code challenge has slightly different instructions. Please refer to the notes and examples below for instructions for each DS&A assignment type.
python level, with the name of the data structure and complete your implementation there
linked_listlinked_list/linked_list.pyFollow Python naming conventions
class LinkedList:
def __init__(self):
# ... initialization code
def method_name(self):
# method body
tests create a test file called test_[data_structure].py
tests/test_linked_list.pyfrom linked_list.linked_list import LinkedListself within your class methodstests and within it, a test file called test_[data_structure].py
tests/test_linked_list.pyCode challenges should be completed within a folder named code_challenges under the python level
python level, with the name of the code challenge
snake_casedcode_challenges/find_maximum_valuesnake_case
find_maximum_value.pyfrom linked_list.linked_list import LinkedListfind_maximum_value(linked_list)tests folder at the root of project.
test_[challenge].py
tests/find_maximum_value.pyfrom code_challenges.find_maximum_value import find_maximum_valueIf you setup your folders according to the above guidelines, running tests becomes a matter of deciding which tests you want to execute. Jest does a good job at finding the test files that match what you specify in the test command
From the root of the data-structures-and-algorithms/python folder, execute the following commands:
pytestpytest -k some_filter_textptw or pytest-watch