/ads-class-pub

Algorithms and Data Structures (CS160)

Primary LanguagePython

README

What is this repository for

  • Algorithms and Data Structures class
  • Class notes
  • Code templates

How do I get set up

Windows users may have to substitute python with py -3 for the following commands to work. You should keep the same file structure as this repository and run all the commands from its top directory (i.e. ads-class-pub).

  • Clone the repository.
git clone https://github.com/LutherCS/ads-class-pub.git
  • Get updates.
git pull origin
  • Install pythonds3 to use textbook implementations of various data structures and algorithms.
python -m pip install -U pythonds3
  • Install linters pylint and mypy.
python -m pip install -U pylint mypy
  • Install formatter black.
python -m pip install -U black
  • Install testing framework pytest and its plugin pytest-timeout.
python -m pip install -U pytest pytest-timeout
  • Install colorama to colorize output.
python -m pip install -U colorama

How do I run my code

  • Run project hello
python projects/hello/hello.py
  • Run project hello that takes file hello_in.txt as input
python projects/hello/hello.py projects/hello/hello_in.txt

The source should be modified as follows (sys.argv contains all the arguments passed to the application, including the application file name itself as sys.argv[0]):

import sys

def main(filename):
    print(f"Processing file {filename}")

    if __name__ == '__main__':
        main(sys.argv[1])
  • Test project hello
python -m pytest projects/hello/hello_test.py
  • Run exercise hello
python exercises/hello/hello.py
  • Test exercise hello
python -m pytest exercises/hello/hello_test.py

References

Text Editors and IDEs

Popular development environments include the following:

Tools and Utilities

Python Basics

Exception Handling

Object-Oriented Programming

Algorithm Analysis

Basic Data Structures

Recursion

Searching Algorithms

Sorting Algorithms

Trees

Graphs