CS 311 Fall 2020: Data Structures and Algorithms

CS 311 Fall 2020
Data Structures and Algorithms

Department: Computer Science, UAF
Instructor: Glenn G. Chappell
Office Hours: No face-to-face office hours during fall 2020; private Zoom sessions are available by appointment
Office phone: (474-)5736
E-mail: ggchappell@alaska.edu
Class meeting Zoom: here (passcode distributed via e-mail)


Course Materials

Materials are listed with the most recent at the top.

Week Class Meetings
See Blackboard for videos
Readings & Homework Handouts & Code
See Git repository for code
Week 5
  • 9/25: Analysis of algorithms; introduction to sorting
  • 9/23: recursive backtracking; unit overview—algorithmic effiency & sorting
  • 9/21: Search algorithms II; eliminating recursion; search in the C++ STL
    Slides [PDF]
  • Online Quiz 8—on Blackboard
    Before taking this quiz, attend the Fri 9/18 & Mon 9/21 classes
    Due 12:30 pm Wed 9/23
  • binsearch4.cpp [C++ source]
    Binary Search
    Implementation #4: iterative (tail recursion eliminated)
  • binsearch3.cpp [C++ source]
    Binary Search
    Implementation #3: tail-recursive
  • seqsearch_compare.cpp [C++ source]
    Compare Sequential Search with Binary Search
    Uses Binary Search implementation from binsearch2.cpp
Week 4
  • 9/18: Recursion vs. iteration
    Slides [PDF]
  • 9/16: Search algorithms I
    Slides [PDF]
  • 9/14: Software engineering concepts: abstraction; a little about Linked Lists; unit overview—recursion & searching; introduction to recursion
    Slides [PDF]
  • Project 3
    Due 5 pm Thu 9/24
  • Online Quiz 7—on Blackboard
    Before taking this quiz, attend the Wed 9/16 class
    Due 12:30 pm Fri 9/18
  • Online Quiz 6—on Blackboard
    Before taking this quiz, attend the Fri 9/11 & Mon 9/14 classes
    Due 12:30 pm Wed 9/16
  • fibo_fast.py [Python 3 source]
    Computing Fibonacci numbers
    Fast method
  • fibo_formula.cpp [C++ source]
    Computing Fibonacci numbers
    Formula implementation
  • fibo_dp_topdown.cpp [C++ source]
    Computing Fibonacci numbers
    Recursive top-down dynamic programming implementation
    A.k.a. memoizing
  • fibo_recurse.cpp [C++ source]
    Computing Fibonacci numbers
    Fast recursive implementaton
  • fibo_iterate.cpp [C++ source]
    Computing Fibonacci numbers
    Iterative implementaton
  • dp3_test.cpp [C++ source]
    Test program for Project 3 functions & templates
    For Project 3, Exercises A, B, C, D
    Uses the “doctest” unit-testing framework, version 2
    Requires doctest.h, dp3.h, dp3.cpp
  • dp3.h [C++ header] SKELETON
    Header for Project 3 functions
    For Project 3, Exercises A–D
  • dp3.cpp [C++ source] SKELETON
    Source for Project 3 functions
    For Project 3, Exercises A–D
  • binsearch2.cpp [C++ source]
    Binary Search
    Implementation #2: recursive (improved)
  • binsearch1.cpp [C++ source]
    Binary Search
    Implementation #1: recursive
  • fibo_first.cpp [C++ source]
    Computing Fibonacci numbers
    First attempt: slow recursive implementation
  • use_list.cpp [C++ source]
    Singly Linked List example: create & find size
    Requires llnode.h
  • llnode.h [C++ header]
    Header for struct LLNode
    Singly Linked List node
    There is no associated source file
Week 3
  • 9/11: Error handling; using exceptions
    Slides [PDF]
  • 9/9: Containers & iterators (cont’d); invisible functions II; thoughts on Project 2
    Slides [PDF]
  • 9/7: No class (Labor Day)
  • Online Quiz 5—on Blackboard
    Before taking this quiz, attend the Wed 9/9 class
    Due 12:30 pm Fri 9/11
  • Project 2
    Due 5 pm  Tue 9/15  Thu 9/17
  • Online Quiz 4—on Blackboard
    Before taking this quiz, attend the Fri 9/4 class
    Due 12:30 pm Wed 9/9
  • allocate2_raii.cpp [C++ source]
    Out-of-memory handling using exceptions, with RAII classes
  • allocate2.cpp [C++ source]
    Out-of-memory handling using exceptions
  • except.cpp [C++ source]
    Demo of throwing & catching exceptions
  • iterators.cpp [C++ source]
    Iterator & STL demo
  • msarray_test.cpp [C++ source]
    Tests for class template MSArray
    For Project 2, Exercise A
    Uses the “doctest” unit-testing framework, version 2
    Requires doctest.h, msarray.h
Week 2
  • 9/4: Managing resources in a class (cont’d); containers & iterators
    Slides [PDF]
  • 9/2: Software engineering concepts: testing; integer types; managing resources in a class
    Slides [PDF]
  • 8/31: Software engineering concepts: invariants; simple class example (cont’d); thoughts on Project 1
    Slides [PDF]
  • Online Quiz 3—on Blackboard
    Before taking this quiz, attend the Mon 8/31 & Wed 9/2 classes
    Due 12:30 pm Fri 9/4
  • Project 1
    Due 5 pm Tue 9/8
  • intarray.h [C++ header]
    Header for class IntArray
    Simple RAII class class holding dynamic array of int
    There is no associated source file
  • intarray_main.cpp [C++ source]
    Simple main program for class IntArray
    Requires intarray.h
  • setmember.cpp [C++ source]
    See how class members are initialized
  • productorder_test.cpp [C++ source]
    Test program for class ProductOrder
    For Project 1, Exercise A
    Uses the “doctest” unit-testing framework, version 2
    Requires doctest.h, productorder.h, productorder.cpp
  • Coding Standards
Week 1
  • 8/28: Invisible functions I (cont’d); simple class example
    Slides [PDF]
  • 8/26: Operator overloading; parameter passing II; invisible functions I
    Slides [PDF]
  • 8/24: Course overview; unit overview—advanced C++ & software engineering concepts; expressions; parameter passing I
    Slides [PDF]
  • Online Quiz 2—on Blackboard
    Before taking this quiz, attend the Wed 8/26 & Fri 8/28 classes and read “On Following Rules”
    Due 12:30 pm Mon 8/31
  • 8/26: Read “On Following Rules”.
    The above date is when the reading is assigned. Each reading should be completed before taking the quiz that covers it—in this case, Online Quiz 2.
  • Online Quiz 1—on Blackboard
    Before taking this quiz, attend the Mon 8/24 class
    Due 12:30 pm Wed 8/26
  • timeofday.h [C++ header]
    Header for class TimeOfDay
    Time of day: hours, minutes, seconds
  • timeofday.cpp [C++ source]
    Source for class TimeOfDay
    Time of day: hours, minutes, seconds
  • timeofday_main.cpp [C++ source]
    Simple main program for class TimeOfDay
    Requires timeofday.h/.cpp
  • invisible.cpp [C++ source]
    Demo of invisible functions
  • Semester Plan
    Updated Sun 8/23
  • Syllabus

External links last checked August 24, 2020.
A comprehensive, up-to-date reference for the C & C++ programming languages and their standard libraries. I have found this site to be very helpful; I use it often.
Git is the the version-control software used in this class. This site includes downloads and a helpful tutorial.
Class Git Repository
Source code for the class will be kept in this repository.
Learn Git Branching
An excellent tutorial. If you are familiar with the Git operations clone, pull, push, add, and commit, but you are having trouble wrapping your head around branching, then this is for you.
doctest: The fastest C++ single-header testing framework
The website (on GitHub.com) for doctest, a C++ unit-testing framework used by all posted test programs in this class. doctest is simple and easy to use, it comprises only a single header file, and it is available as a free download distributed under a FLOSS license.
Links to supplemental readings will be posted here as they are assigned. Links to these will also be in the “Readings & Homework” column of the Course Materials section, above.
On Following Rules
A short essay that makes a good point. From kirit.com, a blog by Norwegian software developer Kirit Sælensminde.