Package: dalpy
DALPyDALPy is a Python module for learning data structures and algorithms. It is based off ofIntroduction to Algorithmsby Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. This library was made specifically for
administering and grading assignments related to data structures and algorithms in computer science.With this module students can receive progress reports on their problem sets in real time as they complete assignments.
Additionally, student submission assessment is done with unit tests, instead of hand-tracing, ensuring that the grades
that students receive accurately reflect their submissions.The DALPy testing suite offers extremely lightweight and flexible unit testing utilities that can be used on any
kind of assignment, whether to write functions or build classes. Course administration can be easily streamlined by
restricting which library data structures students are allowed to use on any particular assignment.DALPy began as a project by two Brandeis University undergraduate students to replace hand-written problem sets
written in pseudocode.Provided Data StructuresThe DALPy library offers a set of fundamental data structures and algorithms, with behavior as specified by
Cormen et al.'sIntroduction to Algorithms. The following structures (separated by module) are supported:arraysArrayArray2DqueuesQueuestacksStacksetsSetlinked_listsSinglyLinkedListNodeDoublyLinkedListNodetreesBinaryTreeNodeNaryTreeNodedepth(NaryTreeNode)hashingHashTableheapsPriorityQueuebuild_min_heap(Array)graphsVertexGraphUnit TestingAlong with the DALPy data structures come test utilities for writing test cases. The testing framework allows a
course administrator to easily write test cases for either expected function output or general class behavior. Test cases
can then be combined into a testing suite. The testing suite has the capability to set a test case run-time timeout and
to record comma-separated test results for administrative use.Consider the example test case below:importunittestfromdalpy.factory_utilsimportmake_stackfromdalpy.test_utilsimportbuild_and_run_watched_suite,generic_testfromstudent_submissionimportstudent_function# TestCase class for testing student_functionclassStudentFunctionTest(unittest.TestCase):# A single test casedefsimple_test_case(self):stack=make_stack([1,2,3])expected=make_stack([1,1,2,2,3,3])generic_test(stack,expected,student_function,in_place=True)# Run the test cases using build_and_run_watched_suite with a timeout of 4 secondsif__name__=='__main__':build_and_run_watched_suite([StudentFunctionTest],4)InstallationDALPy isavailable on PyPI, and can be installed with pip.pip install dalpyDALPy has the following dependencies:Python >= 3.6IssuesWe encourage you to report issues using the GitHub tracker. We welcome all kinds of issues, especially those related to
correctness, documentation and feature requests.Academic UsageIf you are planning to use DALPy for a university course and have questions, feel free to reach out by email.DocumentationThe full documentation for DALPy is availablehere.Sample UsageTo view sample assignments using DALPy browse theDALPy sample problems repositoryon GitHub.NotesThis project was formerly known asCormen-Lib.