Syllabus
CSCI 3300
Introduction to Algorithms and Data Structures
Section 001
Spring 2016

Class meeting 11:00–11:50am MWThF, Brewster D-205
Instructor Karl Abrahamson
Office Sci&Tech C-113
Office hours MWThF 2:00–3:00 and Th 10:00–10:50
or by appointment
Phone 328-9689
Email abrahamsonk@ecu.edu
Course web page www.cs.ecu.edu/~karl/3300/spr16/
My web page www.cs.ecu.edu/~karl/
Text (recommended) Programming Abstractions in C, by Eric S. Roberts
Lecture notes CSCI 3300 Notes (www.cs.ecu.edu/~karl/3300/spr16/Notes/).

Contents

  1. Preamble
  2. Prerequisites
  3. Course objectives
  4. Grading
  5. Programming Assignments
  6. Attendance policy
  7. Recommendations for success
  8. Lecture schedule and reading assignments
  9. Ethical issues
  10. Additional information

Preamble

This class will interfere with your social life. It will cut into your leisure time.

You will need to read the lecture notes and work the exercises in the lecture notes to be successful. Plan to spend significant time week outside of class reading, working the exercises and doing the assignments for this course. The amount of time that you need to spend will depend greatly on how efficiently you work. If you cannot commit adequate time to this course, I recommend that you drop the class.

I will show you how to work efficiently. In the past, many have ignored my advice (and even their own reasoning) and used methods that are proven time wasters. Hopefully, this class will do better. Here are a few things that you should do and things to avoid.

Do.

  1. Read the notes. Do the exercises in the notes. The exercises will help you to remember what you read and understand what you are doing when you work on assignments.

  2. Start to work on assignments early.

  3. Write sensible, concise and precise documentation in your programs early. Do not try to keep information about what a function does only in your head. Writing it down forces you to make your thoughts precise, and that is crucial. It also is very valuable when you come back to your work. You will have forgotten things, and you do not want to spend time reverse-engineering what you wrote earlier.

  4. Follow sound debugging procedures, as explained in class. Put useful traces in your program. Learn how and when to use a debugger.

  5. Proofread what you write.

  6. Draw pictures of data structures that you use. You cannot keep them in your head.

  7. Ask questions when you are stuck. Do not just give up. Do not spend a lot of time trying to figure out one small issue.


Do not.

  1. Do not wait until the due date to start an assignment.

  2. If your program does not work, do not try random experimentation to try to get it work. That will waste your time as you make your program further and further from correct.

  3. If you start late, you will be tempted to turn in someone else's work. Do not plagiarize work, regardless of how tempting it is.


Prerequisites

The prerequisite is CSCI 2310 or equivalent. You should be familiar with the basics of a programming language, such as Java, C++ or C#.

IMPORTANT
This course offers more advanced material on the general topic covered in CSCI 2310, and so, according to university policy, you cannot repeat CSCI 2310 for credit after completing CSCI 3300. If you received a grade of less than C in CSCI 2310, or if you need to retake CSCI 2310 for any reason, do not take CSCI 3300 without consulting me.

Course objectives

The focus of this course is advanced computer programming techniques and algorithms, primarily those that rely on data representation schemes. The language is C++, with emphasis on the C subset. Students are not expected to have used C or C++ before. Part of this course is an introduction to C++, covering all aspects needed in this course.

This course emphasizes concrete aspects of data structures, also called physical data structures. Data abstraction, the other side of data structures, is emphasized in CSCI 3310, although we introduce some of its most basic ideas in this course.

For many of you, the material in this course is the closest you will come to machine language. This course therefore concentrates on the C subset of C++, with only a few features of C++ used. We will not use C++ libraries such as the Standard Template Library. We will see how things are done without relying on others do have implemented the ideas for us.

You will come out of the course able to write working multi-module C++ programs using complex data structures. You should be able to offer arguments concerning the correctness of your programs, and be aware of algorithmic and efficiency issues. For more, see student competencies below.

Topics

The following is a partial list of topics to be covered (though not exactly in the order listed).

  1. Basics of the C subset of C++. Variables, expressions and statements. Control structures. Functions. Recursion. Types and data, including structures and arrays.

  2. Pointers and memory management. Dynamic memory allocation and deallocation

  3. Physical data structures, including linked lists, trees and hash tables.

  4. Algorithms on physical data structures, including both iterative and recursive algorithms. Correctness and efficiency of algorithms.

  5. Abstract data types.

  6. Designing, understanding, testing and debugging programs.

Student competencies

After successfully completing this course, students will have the following abilities.


Grading

Quizzes and the final exam

There will be 13 quizzes, one the following dates.

  1. Thursday, January 21
  2. Thursday, January 28
  3. Thursday, February 4
  4. Thursday, February 11
  5. Thursday, February 18
  6. Thursday, February 25
  7. Thursday, March 3
  8. Thursday, March 17
  9. Thursday, March 24
  10. Thursday, March 31
  11. Thursday, April 7
  12. Thursday, April 14
  13. Thursday, April 21
Each quiz will take roughly half of the class period. After the quiz, I will cover new material. There will be no makeups for missed quizzes.

You can bring one prepared 8.5x11" piece of paper, written on both sides, to each quiz. I will not collect those papers.

I will drop your lowest two quiz grades and count the remaining 11.

The final exam will be at 11:00-1:30 Friday, April 29, in the regular classroom. The final exam will cover all of the material for the course.

You can bring two prepared 8.5x11" pieces of paper to the final exam.

Computing grades

Grades will be computed as follows.

Grading
Eleven quizzes (best 11 of 13) 33% (3% each)
A comprehensive final exam 23%
Nine programming assignments 35% total. By assignment number:
(0: 1%) (1: 3%) (2: 3%) (3: 3%) (4: 3%) (5: 3%) (6: 6%) (7: 6%) (8: 7%)
Attendance 9%

You will start with 9 points for attendance and lose one point for each unexcused absence.

Tentative cutoffs for grades will be as follows. These cutoffs will not be raised.

Grade cutoffs
A 93%
A– 90%
B+ 87%
B 83%
B– 80%
C+ 76%
C 72%
C– 68%
D+ 64%
D 60%
D– 56%

IMPORTANT

It is not possible to learn the material of this course effectively without actually "getting your hands dirty" and doing the programming. Accordingly:

In order to pass this course, you must receive at least a 50% overall grade in the programming assignments.
This outweighs the score computed by adding grades together.

Incompletes

No incompletes will be issued in this course except for extraordinary circumstances, and even then only if you are nearly done already and have done work of acceptable quality, so that it is realistic that you can pass the course. An incomplete will not be given simply because a student could not find the time to do the course work. By registering for this course, you are committing to finding time to do the work.


Programming assignments

Writing and running programs

The programming assignments are available from the course web page.

The programming assignments for this course are probably larger than you have done before. Expect them to take time to complete. If you start on the due date, you will not be able to complete them. Start early, and plan for unexpected difficulties. If you have two weeks to do an assignment, there is a reason.

I will compile and run programs using the g++ compiler on Linux. I will use the following flags when compiling programs:

-g -Wall -Wshadow -Wuninitialized -O
I strongly suggest that you use the same flags.

Grading of submissions

Grading of submissions is explained in the notes. Read that page about how programs will be graded so that you are aware of expectations.

An important point concerns programs that do not compile without fatal errors. I expect you to write working computer programs. I expect you to test your programs on several inputs. If your program does not compile, I know that you have not tested it even once. Accordingly,

IMPORTANT
A program that does not compile without fatal errors receives a grade of 0, regardless of how much work you have put into it or of how close it is to working.

Plagiarism

Plagiarism of programming assignments is a serious problem. Never submit someone else's work as your own. Do not get a copy of a function definition from someone else and insert it into your program. You are expected to do all of your own work. If your submission is 50% your work and 50% someone else's work, then your work is considered to be plagiarized.

IMPORTANT
If I believe that you have submitted plagiarized work, you will receive a grade of −50 points on that assignment. Yes, your points will be negative.

If you share your work with another student, expect that student to submit your work with his or her name on it. Both of you will receive a score of −50.

If I say that your assignment is plagiarized and you do not agree, you are welcome to discuss it with me to explain the circumstances.

To avoid problems with people stealing your work, do not recycle printouts of your program code in a place whether other students can pick them up.


Attendance policy

You are expected to attend class. You are responsible for announcements and assignments given in class. If you miss a class, it is up to you to obtain notes and any other information that was provided in the class. Excuses that you did not know about something because you did not come to class and did not obtain the information will not count for anything at all.

Those who do not attend class can count on doing poorly in this course. If you choose not to attend class, then you must live with the consequences of that decision, however bad they are.

Even if you believe you already know what we are covering, come to class. If you don't, you will end up missing material that you did not know we were going to cover and you will fall behind.

If you are having trouble understanding the lectures, do not stop coming to class. Come to office hours or ask for help from teaching assistants in the lab (Austin 208/209). Get help as early as possible.


Recommendations for success

  1. Attend class. Arrive on time.

  2. Do not bring distractions to class. If you read your email, listen to music, or engage in other distracting activities during class, you will get very little out of class. That will show up in your grade.

  3. Ask questions in class. If you do not understand something, ask a question about it.

  4. Ask questions outside of class. Your best bet is to use email. If you have a question about an assignment, attach all of your files to the email message. Do not just copy the part that you think is wrong into the email message. Ask questions early. Do not wait until the last minute.

    Please use a subject indicating that you are asking a question for CSCI 3300, and always include your name in your email. A reasonable subject for a question about assignment 3 is

    CSCI 3300 question about assignment 3
    Please send email to the address listed on the first page of this syllabus. Do not expect immediate answers. Give yourself time to get answers.

  5. Schedule time to work outside of class.

  6. Do not allow yourself to fall behind. Work on the assignments early. Do not wait until just before the deadline. If you start to fall behind, work right away to catch up. If you are falling behind because you do not understand something, ask for help. Do not just give up!

  7. Read the lecture notes twice. Take a break (like a whole day or longer) in between. Work the exercises. Later in the term, go back over notes that you looked at earlier in the term. You will learn much more that way.

  8. Get adequate sleep. Sleep is important both before and after you learn new concepts. Sleep before enables you to concentrate, and sleep afterwards is critical for moving new information into permanent memory.


Lecture schedule and reading assignments

The following schedule lists brief topics along with sections from the lecture notes that cover them. You should read the relevant sections of the lecture notes before the class. Sections in parentheses are important to read but will probably not be discussed in class except to answer questions.

This outline is tentative and might need to be adjusted.

Date Topics Reading
M. 1/11 Introduction.
Syllabus. General advice.
System: Linux, NX, ssh.
Assignment 0 assigned.
3.1. Logging in
3.2. Basic Linux
(1.  Introduction)
(2.  Advice)
W. 1/13 Introduction.
C/C++ and machine language.
Compiling and running C++ programs.
Grading of assignments.
Coding standards.
How to work assignments.
5.1.  Discussion of C++
3.3.  Compiling and running C++ programs
(3.6.  Submitting assignments)
(6.1.  Standards: motivation)
(6.2.  Standards: file names)
(6.9.1. Standards: statements)
Th. 1/14 C++:
Numeric expressions and types. Numeric Constants.
Operator precedence.
Variables and assignment. Abbreviations for assignments.
Statements and sequencing.
Scope.
5.3.1. Expressions
5.3.2. Numeric expressions
5.3.6. Precedence
5.4.  Statements
5.5.  Variables
5.8.  Scope
F. 1/15 C++:
Boolean values and expressions. Comparisons.
If-statements.
Compound statements. Indentation.
Coding standards for if-statements.
5.3.3. Boolean values and expressions
5.6.1. Making decisions
6.3.  Standards: file format and indentation
6.6.  Standards: types, constants and expressions
6.9.2. Standards: components of statements
6.9.3. Standards: conditionals
M. 1/18 Holiday  
W. 1/20 C++:
Functions. Using functions.
Defining functions.
Standards for function definitions.
Function contracts.
Assignment 0 due.
5.7.1. Functions
5.7.2. Defining functions
6.5.  Standards: variables and parameters
4.1.  Documentation
5.2.  C++ comments
4.2.  Contracts
(4.3.  Other documentation)
(6.4.  Standards: variable and function names)
Th. 1/21 Quiz 1.
C++:
Parameter passing.
Call by value and call by reference.
5.7.5. Parameter passing

Review: (work all of the exercises!)
5.3.1. Expressions
5.3.2. Numeric expressions
5.3.6. Precedence
5.5.  Variables
5.3.3. Boolean values and expressions
5.6.1. Making decisions
F. 1/22 C++: While-loops.
Coding standards for loops.
Algorithms:
Planning a loop. Loop invariants.
5.6.3.1. While-loops
8.6.   Loop invariants
6.9.4.  Standards: loops
(6.9.5  Standards: commas and gotos)
M. 1/25 C++:
For-loops. Breaking out of loops.
Infinite loops.
The main function.
5.6.3.3. For-loops
5.6.3.4. Breaking out of a loop
5.6.3.5. Infinite loops
5.7.6  Main
6.9.4.  Standards: loops
W. 1/27 C++:
Procedures.
Input and Output using the stdio library.
5.7.4  Procedures
5.9.1.  Standard input and standard output
5.9.2.1. Output
5.9.2.3. Input
(5.9.4.  Buffering)
Th. 1/28 Quiz 2.
C++:
Function calls and frames.
Algorithms:
Recursion.
Assignment 1 assigned.
5.7.2.  Frames
8.3.   Recursion

Review: (work all of the exercises!)
5.7.1.  Functions
5.7.2.  Defining functions
4.2.   Contracts
5.6.3.1. While loops
5.6.3.3. For-loops
5.6.3.4. Breaking out of a loop
F. 1/29 Algorithms:
Scan algorithms. Planning scan algorithms.
C++:
Elementary arrays.
8.3. Recursion
8.5. Scan algorithms
8.6. Loop invariants
M. 2/1 Algorithms:
Search algorithms.
8.7. Search algorithms
W. 2/3 Algorithms:
Algorithm development. Top-down design.
(8.1. Process)
(8.2. Discovery)
Th. 2/4 Quiz 3.
Algorithms:
More examples using recursion.
Tail recursion.
Assignment 2 assigned.
8.3.  Recursion
8.4.  Tail recursion

Review: (work all of the exercises!)
5.7.2. Defining functions
8.3.  Recursion
8.5.  Scan algorithms
8.7.  Search algorithms
F. 2/5 C++:
The memory and pointers.
Operations on pointers.
Assignment 1 due.
5.10.1. Memory
5.10.2. Pointers
5.10.3. More on pointers
M. 2/8 C++:
Areas of memory.
Allocating and deallocating memory in the heap.
Dangling pointers. Memory faults.
Memory leaks.
5.10.4. Areas of memory
5.10.5. Using the heap
5.10.6. Dangling pointers and memory faults
W. 2/10 C++:
Arrays.
Arrays as pointers.
Arrays as parameters. Const parameters.
Allocating and deallocating arrays.
5.11.1. Arrays
5.11.3. Arrays as pointers
5.11.4. Arrays as parameters
5.11.5. Allocating and deallocating arrays
Th. 2/11 Quiz 4.
C++:
Array size. Pointer arithmetic.
5.11.2. Array size

Review: (work all of the exercises!)
5.10.2. Pointers
5.10.5. The heap
5.10.6. Dangling pointers
8.3.  Recursion
8.5  Scan algorithms
8.7  Search algorithms
F. 2/12 Assignment 3.
C++:
Header files. Linking.
Function prototypes.
Assigment 3 assigned.
Assignment 2 due.
Assignment 3
M. 2/15 C++:
Characters.
Null-terminated strings.
String constants.
5.3.4. Characters
5.12.1. Null-terminated strings
W. 2/17 C++:
Structures. Operations on structures.
Constructors.
Passing structures as parameters of functions.
5.13.1. Structures
5.13.2. Using structures
5.13.3. Constructors
5.13.4. Structure parameters
Th. 2/18 Quiz 5.
C++:
Parameterless constructors.
Arrays of structures.
Review: (work all of the exercises!)
5.11.1. Arrays
5.11.3. Arrays as pointers
5.11.5. Allocating arrays
5.11.4. Arrays as parameters
5.3.4. Characters
5.12.1. Null-terminated strings
F. 2/19 Assignment 4.
Data structures:
Graphs. Representing a graph as an array of edges.
Assignment 4 assigned.
Assignment 4
M. 2/22 Data structures:
Abstract data types.
Conceptual lists. Operations on conceptual lists.
Equations on lists.
Assignment 3 due.
10.1.1. Conceptual lists
10.1.2. Equations
W. 2/24 Data structures:
Linked lists.
Functions on linked lists.
5.13.5 Additional issues on structures
10.1.3. Linked lists
10.1.4. Nondestructive functions on linked lists
Th. 2/25 Quiz 6.
Data structures:
Memory sharing.
10.1.5. Memory sharing

Review: (work all of the exercises!)
5.13.1. Structures
5.13.2. Using structures
5.13.3. Constructors
10.1.1. Conceptual lists
10.1.2. Equations
F. 2/26 Data structures:
Destructive operations on linked lists.
Comparison with arrays.
10.1.7. Destructive operations on lists
10.1.8. Comparison with arrays
M. 2/29 Assignment 5.
Assigment 5 assigned.
Assignment 5
10.3.4. Priority queues
W. 3/2 Data structures:
More examples using linked lists.
Looping over linked lists.
Assignment 4 due.
10.1.6. Looping over lists
Th. 3/3 Quiz 7.
C++:
Implementing abstract data types.
Shrink-wrapping priority queues.
Review: (work all of the exercises!)
10.1.1. Conceptual lists
10.1.2. Equations
10.1.3. Linked lists
10.1.4. Nondestructive functions on linked lists
10.1.7. Destructive operations on lists
F. 3/4 Assignment 6.
Algorithms and data structures:
Simulation. Events and the event queue.
Representing a graph using an adjacency list.
Assignment 6 assigned.
Assignment 6
M. 3/7 to F. 3/11 Fall break  
M. 3/14 Algorithm analysis:
Algorithm analysis.
Big-O and big-Θ notation.
Logarithms.
9.1. Analysis
9.2. Example
(9.3. Profilers)
W. 3/16 Data structures:
FIFO queues.
Represention schemes for a FIFO queue.
Assignment 5 due.
10.3.1. FIFO queues
10.3.2. Linked queues
10.3.3. Array queues
(5.11.6. Reallocating an array)
Th. 3/17 Quiz 8.
Debugging:
Tracing. Controlling tracing.
Using gdb.
7.5.  Tracing
7.6.  Using a debugger

Review: (work all of the exercises!)
9.1.  Analysis
10.1.6. Looping over lists
F. 3/18 Data structures:
Trees. Functions on trees.
10.2.1. Trees
10.2.2. Trees in C++
M. 3/21 Data structures:
More examples with trees.
Traversing a tree.
10.2.3. Traversing trees
W. 3/23 Data structures:
Tables and sets.
Examples of representations of tables and sets.
Binary search.
10.2.4. Tables and sets
Th. 3/24 Quiz 9.
Review: (work all of the exercises!)
10.3.1. FIFO queues
10.3.2. Linked queues
10.2.1. Trees
10.2.2. Trees in C++
10.2.3. Traversing trees
F. 3/25 Holiday  
M. 3/28 Assignment 7.
Assignment 7 assigned.
Assignment 6 due.
Assignment 7
W. 3/30 Data structures:
Binary search trees.
Operations on binary search trees.
10.2.5. Binary search trees
Th. 3/31 Quiz 10.
Data structures:
Height-balanced binary search trees.
10.2.6. Balanced search trees

Review: (work all of the exercises!)
10.2.1 Trees
10.2.2 Trees in C++
10.2.3. Traversing trees
10.2.5. Binary search trees
F. 4/1 Data structures:
Height-balanced binary search trees.
Rotations. Why do rotations work?
10.2.6. Balanced search trees
10.2.7. Implementation of balanced trees
M. 4/4 Data structures:
Review of height-balanced binary search trees.
When and where to do rotations.
Cost of operations on height-balanced binary search trees.
10.2.6. Balanced search trees
W. 4/6 Assignment 8.
Assignment 8 assigned.
Assignment 8
Th. 4/7 Quiz 11. Review: (work all of the exercises!)
10.2.5. Binary search trees
10.2.6. Balanced search trees
F. 4/8 Data structures:
Hash tables with chaining.
Assignment 7 due.
10.4. Hash tables
M. 4/11 Data structures:
Heaps and priority queues.
Operations on heaps.
10.3.5. Heaps
W. 4/13 Algorithms: Sorting. Naive sorting. Analysis.
Naive and in-place heapsort.
 
Th. 4/14 Quiz 12.
Algorithms:
HeapSort.
Building a heap
Analysis of HeapSort.
10.3.6. Heapsort

Review: (work all of the exercises!)
10.3.5. Heaps
10.4.  Hash tables
F. 4/15 Algorithms:
Sorting a linked list using MergeSort.
Analysis of MergeSort.
10.1.9. Sorting a linked list
M. 4/18 Review:
Equations on linked lists.
10.1.1. Conceptual lists
10.1.2. Equations
10.1.3. Linked lists
10.1.4. Nondestructive functions on linked lists
W. 4/20 Algorithms:
Quicksort.
 
Th. 4/21 Quiz 13. Review: (work all of the exercises!)
10.1.1. Conceptual lists
10.1.2. Equations
10.1.3. Linked lists
10.1.4. Nondestructive functions on linked lists
10.1.6. Looping over lists
F. 4/22 Algorithms:
Improving quicksort.
A lower bound for sorting.
Assignment 8 due.
 
M. 4/25 Review.
Arrays.
Null-terminated strings.
5.11.3. Arrays as pointers
5.12.1. Null-terminated strings
T. 4/26 Today is treated as a Friday.
Review.
Binary search trees.
Heaps.
Hash tables.
10.2.6. Balanced search trees
10.3.5. Heaps
10.4.  Hash tables
W. 4/27 Reading day.  
F. 4/29 Final exam, 11:00–1:30am.  

Ethical issues

You can feel free to get help from anyone on the following issues concerning programming assignments.

  1. Understanding the problem description.
  2. Using the system software and hardware.
  3. Understanding the source of compile errors.
  4. Understanding broad issues of program or algorithm design for the problem.

But, other than from the instructor or graduate student tutor, it is considered cheating to obtain assistance for the following.

  1. Writing your program. This means any discussion about writing code or specifying algorithmic details.
  2. Fixing your program beyond syntax errors except for having someone ask you questions about your code. You must figure out how to change your code when errors are discovered (or talk to the instructor).

Additional information

For information about

please see the auxiliary information at http://www.cs.ecu.edu/~karl/3300/spr16/syllabus-aux.html.