MCS2514: Computer Science 2
Chap1
PreCondition and PostCondition (MS PowerPoint Slides, 294KB)
Assert: assert.cpp
Running Time Analysis (Big-O Notation) - How many "Wow"s?: 1 , 2 , 3 , 4
Chap2: ADT / Classes and Objects
Basics: point1.cpp | Expected Output
Friend Function and Default Arguments: point2.cpp
Operator Overloading: point3.cpp | Expected Output
Overloading Output and Input Operators: point4.cpp
Application: How many rotations? (Page 65) point5.cpp
Automatic assignment op. and Copy Constructor: point6.cpp
Chap3: Container Classes
More C++ Features
sizeof() and size_t data type: sizeof.cpp
enumeration type: enumtst.cpp
static member constants: staticconst.cpp
typedef: typedef1.cpp
File stream I/O and Output Formatting format.cpp
bag1 + bag2, bag += bag: bagtst1.cpp
List: list.cpp
Chap4: Pointers and Dynamic Arrays
Review Pointers: pointer1.cpp
Value Parameters that are pointers, Array Parameters, and Reference Parameters that are pointers: pointer2.cpp
The bag ADT with a dynamic array: dynmbag.cpp
Overloading subscript [] operator: safearray.cpp
Chap5: Linked List
Fundamentals of Linked List using "struct": linklist0.cpp
Bag class using linked list: bag3main.cpp | node1.h
Doubly linked list using "struct": doublelink.cpp
Chap6: Software Reuse with Templates
Class Templates II, member functions are outside of class def.
Template Version of Linked List Toolkit: link2.h
Chap7: Stacks
Chap14: Software Reuse with Derived Classes
Derived class: A simple sample program .
Private and Public Inheritance - see page 649
With a public base class, all the public members of the base class are inherited as public members of the derived class.
With a private base class, all the public members of the base class are inherited as private members of the derived class.
Multiple Inheritance - Not covered
Virtual functions - Not covered in CS2
istream and ifstream: inherit0.cpp and inherit1.cpp .
C++ topics
Managing a file with Objects, seekg: rwobj.cpp
Chap8: Queues
FIFO, Queue underflow, overflow
Queue application: Recognizing Palindromes - queue1.h(using a circular array), stack1.h, pal.cpp
Queue application: Recognizing Palindromes (using linked lists) - queue2.h, stack2.h, link2.h pal2.cpp
Priority Queues (p410): (1) Using a tree data structure (2) Linked List (3) ...
Chap9: Recursive Thinking
A first example of recursive thinking: write_vertical; an iterative solution , recursive solutions
Tower of Hanoi Problem: hanoi.cpp
Maze Problem: maze.cpp
One level recursion, p442
Becareful: Infinite recursion, inf_recur.cpp
What's wrong?: powx.cpp
Chap10: Trees
Constructing Binary trees; Tree Traversals (pre-order, in-order, and post-order) bintree2.h, testtrav.cpp, output
Binary Search Trees: Insert, Search, and Remove - bst.cpp
Copyright (C) 2000- by Chung