EXAMPLES

PIC 10C, Winter 2004


  1. Illustration of various sorting algorithms. Interface and implementation of each are provided in files sort.h and sort.cpp respectively. Sorting algorithms are organized as static methods of Sort class. Each of the sorting algorithms works on objects of type Sortable. The latter is an abstract interface, which declares methods necessary for any kind of sortable objects. If we want to sort objects of a particular data type using the methods from Sort class, this data type must, implement the Sortable interface, in other words it should be publicly derived from the class Sortable. As a proof that all this really works, here is a very simple class Data derived from the Sortable ADT. Its objects hold integral values. The class provides implementation of methods required by Sortable. Finally, a driver program allows us to compile all this into an executable, and test our ideas.
  2. Illustration of several kinds of templates and their uses. (Sample Code from "C++ in a Nutshell" by R. Lischner; ISBN 0-596-00298-x.)
  3. A "bare-bones" implementation of a Linked List with a driver program necessary for Homework Project 2:
  4. A "bare-bones" implementation of RSA encryption/decryption algorithms necessary for Homework Project 4:



Last modified on by fedandr@math.ucla.edu.