Lecture Notes for Computer Science 2530
Spring 2020

January Part 1
February Part 2
March Part 3
April Part 4
May Part 5

  • Adjust your browser width to your liking.

  • Text in this color is C++ code.

  • Text in this color is incorrect C++ code.

  • Text in this color is a type,

  • Text in this color is a function name, except when in C++ code.

Reference
  CSCI 2530 course web page
  Coding standards
  Introduction to Linux


Lectures

Part 1. General issues

1. [M. January 13]
  Syllabus
  Lecture 1A Critical issues from the syllabus
  Lecture 1C Who should study computer science?
  Lecture 1D What you should already know
  Lecture 1E Course philosophy
  Lecture 1F Two themes
  Lecture 1G Things not to use in C++
  
Part 2. Programming languages, elementary program development and C++ fundamentals

2. [W. January 15]
  Lecture 2A Programming languages
  Lecture 2B Compilers and develoment environments
  Lecture 2C Standards
  Lecture 2D Programming language syntax and layout
  Lecture 2E Values and types
  Lecture 2F Expressions
  Lecture 2G Functions
  Lecture 2H Conversions
  Assignment 0 assigned
  
3. [Th. January 16]
  Lecture 3A Function libraries
  Lecture 3B Statements
  Lecture 3C Compound statements
  Lecture 3D Input and output
  Lecture 3E Writing to the standard output
  
4. [F. January 17]
  Lecture 4A Reading from the standard input
  Lecture 4B Variables
  Lecture 4C Assignment statements
  Lecture 4D Variable Initialization
  Lecture 4E Abbreviations for assignment statements
  Lecture 4F Compound statements and scope
  
[M. January 20]
 Holiday
  
5. [W. January 22]
  Lecture 5A Defining functions
  Lecture 5B Side effects, pure functions and void functions
  Lecture 5C Return statements
  Lecture 5D Calling your functions
  Lecture 5E Where do parameters come from?
  Lecture 5F Treat parameters as constants
  Assignment 0 due
  
6. [Th. January 23]
  Lecture 6A Programs and the main function
  Lecture 6B The order of function definitions
  Lecture 6C Large software and programming principles
  Lecture 6D Hand simulation
  Lecture 6E Type checking
  Assignment 1 assigned
  
7. [F. January 24]
  Lecture 7A Tracing
  Lecture 7B Mental model of functions 1: What does the function accomplish?
  Lecture 7C Function contracts
  Lecture 7D Choosing function, parameter and variable names
  
8. [M. January 27]
  Lecture 8A Boolean expressions
  Lecture 8B Mental model of boolean expressions
  Lecture 8C Booleans are values
  Lecture 8D Making decisions
  Lecture 8E Pitfalls with if-statements
  Lecture 8F Standards for if-statements
  
9. [W. January 29]
  Lecture 9A Repetition
  Lecture 9B While-loops
  Lecture 9C Checking loops
  
10. [Th. January 30]
  Lecture 10A Planning while-loops
  Lecture 10B Loop invariants
  Assignment 1 due
  
11. [F. January 31]
  Lecture 11A For-loops
  Lecture 11B Planning for-loops
  Lecture 11C Additional features of for-loops
  Lecture 11D Standards for loops
  
[M. February 3]
  Exam 1
Lectures
  
Part 3. Algorithmic fundamentals and program development

12. [W. February 5]
  Lecture 12A Scan algorithms
  Lecture 12B Filtered scans
  
13. [Th. February 6]
  Lecture 13A Elementary arrays
  Lecture 13B Scan algorithms on arrays
  Assignment 2 assigned
  
14. [F. February 7]
  Lecture 14A Search algorithms
  Lecture 14B More on search algorithms
  
15. [M. February 10]
  Lecture 15A Mental model of functions 2: how function calls are performed by the Computer
  Lecture 15B Recursion
  
16. [W. February 12]
  Lecture 16A Understanding recursion
  Lecture 16B Example: computing powers
  Lecture 16C Top-down design
  
17. [Th. February 13]
  Lecture 17A Making sure that a recursive function stops
  Lecture 17B Recursive scan algorithms
  
18. [F. February 14]
  Lecture 18A Recursive search algorithms
  Lecture 18B Tail recursion
  Lecture 18C Duplicated recursive calls
  Assignment 2 due
  Assignment 3 assigned
  
19. [M. February 17]
  Lecture 19A Detecting, diagnosing and fixing errors
  Lecture 19B Testing
  Lecture 19C Localizing errors and successive refinement
  Lecture 19D The memory and memory addresses
  Lecture 19E Pointers and operations on pointers
  
Part 4. The memory and C++ features for working with the memory

20. [W. February 19]
  Lecture 20A Hand simulation with pointers
  Lecture 20B Areas of memory
  Lecture 20C Allocating and deallocating memory in the heap
  
21. [Th. February 20]
  Lecture 21A Ownership of memory and memory faults
  Lecture 21B Dangling pointers
  Lecture 21C Finding and fixing causes of memory faults
  Lecture 21D Using a debugger
  Lecture 21E Memory leaks
  
22. [F. February 21]
  Lecture 22A Arrays
  Lecture 22B Creating arrays
  Lecture 22C Deleting arrays
  Lecture 22D Chunks are not automatically copied
  
[M. February 24]
  Exam 2
Lectures
  
23. [W. February 26]
  Lecture 23A Array bounds
  Lecture 23B Passing arrays to functions
  Lecture 23C Logical and physical size
  Lecture 23D Example
  Lecture 23E Returning an array from a function
  
[Th. February 27]
  Assignment 3 due
  Assignment 4 assigned
  Assignment 4
  
24. [F. February 28]
  Lecture 24A Physical parameter passing modes
  Lecture 24B Logical parameter passing modes
  
25. [M. March 2]
  Lecture 25A Type definitions
  Lecture 25B Modules
  Lecture 25C Linkage
  
Part 5. Data structures and algorithms

26. [W. March 4]
  Lecture 26A Null-terminated strings
  Lecture 26B Standard operations on null-terminated strings
  
27. [Th. March 5]
  Lecture 27A Algorithms on null-terminated strings
  Lecture 27B Reading and writing strings
  
28. [F. March 6]
  Lecture 28A Structures
  Lecture 28B Creating structured values
  Lecture 28C Referring to fields in structures
  Lecture 28D Copying structures
  Lecture 28E Constructors
  Lecture 28F More on constructors
  Assignment 4 due
  
[M. March 9 – F. March 13]
  Spring break

Note. Dates below (in red) have been adjusted to reflect the extra week off due to coronavirus. Although you are not required to, I recommend that you begin on assignment 5 as soon as feasible.
  
[M. March 16]
  Assignment 5 assigned
  Lecture 29C Forward and recursive structure type definitions
  Lecture 29D Naming and documentating structure types
  
30. [M. March 23]
  Lecture 30A Abstract data types
  Lecture 30B Conceptual Lists
  Lecture 30C Linked lists
  Lecture 30D Implementation of linked lists
  
31. [W. March 25]
  Lecture 31A Equations about lists
  Lecture 31B Using equations to derive algorithms
  Lecture 31C Another example using equations
  Lecture 31D Summary and Another Example
  
32. [Th. March 26]
  Lecture 32A Example: produce a modified list
  Lecture 32B Example: select the even members of a list
  Lecture 32C Example: is one list a prefix of another?
  
33. [F. March 27]
  Lecture 33A Looping over linked lists
  Lecture 33B Example: sum of the numbers in a list
  Lecture 33C Example: reversing a list
  Lecture 33D Summary and Caution
  
[M. March 30]
  Exam 3
Lectures
  
34. [W. April 1]
  Assignment 5 due
  Assignment 6 assigned
  Lecture 34A Destructive functions on linked lists
  Lecture 34B Example: Sort a linked list
  Lecture 34C Example: Remove a value from a linked list
  Lecture 34D Example: Modify the items in a linked list
  Lecture 34E Memory sharing
  
35. [Th. April 2]
  Lecture 35A Logarithms
  Lecture 35B Comparison of common functions
  Lecture 36A Elementary analysis of algorithms
  
36. [F. April 3]
  Lecture 36B Examples algorithms
  Lecture 36C Linear and binary search
  
38. [M. April 6]
  Lecture 38A Binary Trees
  Lecture 38B Trees in C++
  Lecture 38C Nondestructive functions on trees
  
39. [W. April 8]
  Lecture 39A Traversing trees
  Lecture 39B Destructive functions on trees
  
40. [Th. April 9]
  Assignment 7 assigned
  Lecture 40A Binary search trees
  Lecture 40B Lookup and insertion
  Lecture 40C Removing the smallest value from a binary search tree
  
[F. April 10]
 Holiday
  Assignment 6 due
  
[M. April 13]
  Exam 4
Lectures
  
41. [W. April 15]
  Lecture 41A Deletion from a binary search tree
  Lecture 41B Height-balanced binary search trees
  
42. [Th. April 16]
  Lecture 42A Doing rotations to keep a binary search tree height-balanced
  Lecture 42B Getting the height of a node and full implementation
  Lecture 42C Review of how to do rotations
  
43. [F. April 17]
  Lecture 43A Tables
  Lecture 43B Hash functions
  Lecture 43C Hash tables
  
44. [M. April 20]
  Lecture 44A Heaps and priority queues
  Lecture 44B Representing a heap as an array
  Lecture 44C Inserting into a heap
  Lecture 44D Removal from a heap
  Lecture 44E The cost of heap operations
  
45. [W. April 22]
  Lecture 45A Sorting a linked list using Insertion Sort
  Lecture 45B The cost of Insertion Sort
  
46. [Th. April 23]
  Assignment 7 due
  Lecture 45C Merge Sort
  Lecture 45D Analysis of Merge Sort
  Lecture 45E Implementation of Merge Sort for linked lists
  Lecture 45F Summary and Optimality of Merge Sort
  
[F. April 24]
  Exam 5
Lectures
  
47. [M. April 27]
  Lecture 46A Heap Sort
  Lecture 46B Building an Initial Heap
  Lecture 46C Sorting using heaps
  
48. [T. April 28]
  Lecture 46D Analysis of Heap Sort
  
[F. May 1]
 Final exam for section 002: 2:00–4:30
  
[W. May 6]
 Final exam for section 001: 11:00–1:30