CS190-CP0 (Introduction to Programming)

General Course Information

Description: CP0 is designed to teach students who have little or no prior exposure to programming how to think computationally and write programs to solve non-trivial problems. The course is taught in a problem driven fashion, where language features and programming techniques are demonstrated using code to solve example problems. The course uses C++, but will focus on the procedural parts of C++ that are largely shared by Java and C. The focus is not on the C++ language, but rather how to program. Emphasis is on effective usage of primitive data types, expressions, control statements, arrays, functions, strings, bit operations, and a few classes in STL (e.g., vector, pair, string).

Pre-requisite: High School Geometry

Expected Workload: There will be 10 topics, each having one problem set. Each topic has videos between 1 hour and 2 hours, and 4 to 10 additional hours for homework problems.

Instructor: Ninghui Li

Topics

  Course Material Concepts Additional Info
Topic 1
Introduction
    Comments, whitespaces, pre-processors (include and macros), variables, declaration, int type, expressions, operators, assignment (=, +=, ++), compound statements, input/output, if statement, comparison operators, logical operators, literals.
Topic 2
For Loop and Function
    Data types: float, double, bool. For loop. String literals. Escape characters. Macro expansion. Functions. Math functions. Overflow. Implicit conversion.
Topic 3
Array I
    Array, vector, template class, stl, constructor, max, min, conditional expression, numerical values as boolean values, %, variable scopes, const, while loop, enhanced for loop, call by value versus call by reference
Topic 4
Array II
    Online algorithm problems. Multi-dimensional array. Modular simulation design.
Topic 5
Elementary Sorting
    Running time as a function of input size; elementary sorting algorithms, namely, bubble sort, selection sort, and insertion sort; two pointer techniques.
Topic 6
Using Sorted Array
    Pointer to index; Binary search; Intro to subset sum problem.
Topic 7
String
    String operations.
Topic 8
Number Representation
    Numbers in binary; two’s complement for negative numbers; bit operators
Topic 9
Mergesort and Quicksort
    Recursion, divide-and-conquer, quicksort, mergesort.
Topic 10
Set and Map
    set, unordered_set, map, unordered_map