General Information
Discipline Information (including Academic Honesty, Late Work, Contact Information, etc.)
Prerequisites: CS 404 is the official prerequisite, but we encourage you to have taken CS 406 as well. An AP Computer Science score of 4 or 5 will also get you into this class. However, we strongly encourge students who have taken the AP to sign up for CS404, as its approach to OO and GUIs is radically more ambitious than the APCS curriculum. There will be a quick review of UNIX at the beginning of the class to get students up to speed with command-line programming.
Course Textbook:
- Chapter 1 of Morrison, J, Computing in Python for material on the UNIX command line
- Learn C the Hard Way
You should complete as many exercises in this as you can. It will exceed what
we do in class, but a firm command of it is a huge notch on a resume. You can
learn about
make
and other useful utilities here. - Aho and Ullman's The Giant Turtle Book This will be our source for a lot of material on algorithmics We will focus on chapters 1-4 and chapter 6. You should download the chapters to your lappy so they are available offline. This book belongs to the Public Domain. You can download it to your lappy for easy access.
Course Description: This is an advanced course. It will introduce you to C, pointers, dynamic memory management, and you will learn about an array-based and link-based implementation of lists; if time allows we will build a hash table and trees as well.
Course Objectives: These are the things you will learn about.
- You will learn to program in the C language. This include all details on pointers, functions, structs and unions.
-
You will learn how to manage memory on the heap using
malloc
andfree
. -
You will learn how to use the
gdb
debugger to trace code andvalgrind
to find and extirpate memory leaks. - You will implement an array-based list in C without memory leaks.
- You will learn about link-based stacks, and then extend this to a full-service link-based list.
- You will learn how to execute a mathematical induction argument and how induction relates to recursion in computer programs.
Rough outline of the class
This class will be taught in C. You will be assumed to be a proficient coder in a couple of other languages, so this will not proceed at an introductory pace. Since we will program at the UNIX command line, a quick review of UNIX commands will be done at the beginning of this class. Then we will study the C language, roughly in this order.
The C Language Unit
- Basic C Program Structure
- The Preprocessor
- Preprocessor Macros/li>
- Conditional Compilation/li>
- The Main Routine
- Comment Tokens
- C variables and their scope
- global variables
- local variables in
main
- Using gdb to trace code
- C Functions
- Function Prototypes
- Function Parameters and Local Variables
- C Scoping Rules
- The call stack
- C is a pass-by-value Language
static
storage in local variables- Using Libraries
- Boss Statements in C
- Conditional Execution
switch
progressions- The
while
loop - The
do while
loop - The
for
loop static
storage in local variables
- C Data Structures,
struct
and Arrays- Declaring an Array
- Traversing Arrays and Entry Access
- Heterogeneous Data Structures: the
struct
- C Pointers
- Anatomy of a Program: The main code segments
- The Abstraction of Virtual Memory
- Accessing virtual memory addresses via pointers
- Allocation and deallocation of memory on the Stack
- Function Pointers
- Valgrind: it will hurt your feelings
Important C Libraries
stdio.h
, the standard IO library for Cmath.h
, the math library for Ctypes.h
, the character type libararystdlib.h
, for memory allocation and other utilitiesstring.h
, for string handlingtime.h
, for dates and timesassert.h
, for halting programs at an errorunistd.h
, for C/UNIX functionsstat.h
, for statting files
After we get a basic mastery of C, we will study some key ideas in algorithmics, then we will look at the List Model.
Course Goal: You will learn to program in C at the UNIX command line and learn how to manage memory dynamically. We will study the list data model and fully implement array-based and link-based list structures. We will also lay the mathematical foundations for studying the general theory of algorithms. All mathematical writing will be done in LaTeX format.
Class Mechanics This is a general description of how things work in CS classes at NCSSM.
Grading
Grading Your grade in this class will come from several sources. You can compute your grade from returned work. Projects and the lab practical will be posted when you have your Personal Feedback Session on them.
- Tests 30%: There will be three lab practicals, one on core C syntax the other on dynamic memory allocation, and a final practcal that will menace and vex you. You will be given a choice of functions to code, and will have 90 minutes to code your choices. The purpose of these is to test your knowledge of the C programming language.
- Programming Projects and Problem Sets, 50%: There several programming projects. One or more may be group projects. Sometimes you will have a choice of partner, sometimes this will be randomly assigned. There will also be some assignments of a mathematical nature.
- Final Project: This may be done solo or in partnerships of two. You are to create a working application in the using the principles learned in this class. You are encouraged to use external code and libraries. You must give credit if you are using code not in C's Standard Libraries. The final project counts twice a regular programming project grade and it is averaged in with your other projects.
- Class Participation, 20%: You are expected to participate in the life of this class by contributing to discussions. You may be called upon to appear in front of class to lead a discussion or to create code.
Grading Scale:
A: 90 - 100
B: 80 - 89
C: 70 - 79
D: Below 69