# CS1010

## What's New

Updated for digits and square.

### Lecture 12

In this lecture, we will review what we have covered in CS1010 as well as to peak ahead to give you a teaser of CS2040C. There is no notes for this lecture.

### Lecture 11

In this lecture, we discussed a few C specific topics: struct, typedef, printf, and scanf. We covered Unit 28 and Unit 29.

## Piazza Q&A

Piazza is the Q&A site for students and instructors to ask questions and discuss among each other on all matters related to CS1010.

## Notes and Lectures

### Lecture 11

In this lecture, we discussed a few C specific topics: struct, typedef, printf, and scanf. We covered Unit 28 and Unit 29.

### Lecture 10

In this lecture, we discussed three classic recursive algorithms: the Tower of Hanoi (Unit 25), generating permutations (Unit 26) and the $n$-Queens Problem (Unit 27).

### Lecture 9

In this lecture, we will discuss three classic algorithms: binary search (in Unit 23) bubble sort, and insertion sort (both in Unit 24: Sorting). Note: There are no slides.

### Lecture 8

In this lecture, we introduced C pre-processing, the assert macros, and the notion of efficiency in algorithms.

Units covered are Units 20 - 22: Unit 20: C Pre-processing, Unit 21: Assert, Unit 22: Efficiency.

### Lecture 7

In this lecture, we discussed how call-by-reference works in C, talked about memory allocation on the heap, and moved on the multi-dimensional arrays.

Units covered are Units 17 - 19: Unit 17: Call by Reference, Unit 18: Heap, Unit 19: Multi-Dimensional Arrays.

### Lecture 6

In this lecture, we discussed how call stack works, giving more insights about how a C program is executed, particularly when we call a function and when a function returns. We then discussed about pointers and arrays, ending with a brief introduction to strings as an array of char.

Units covered are Units 13 - 16: Unit 13: Call Stack, Unit 14: Pointers, Unit 15: Arrays and Unit 16: Strings.

### Lecture 5

In this lecture, we talked about how to write loops, followed by using assertions to reason about the behavior and logic of our programs.

Units covered are Units 10 Assertions, 11 Loops, and 12 Reasoning About Loops.

### Lecture 4

In this lecture, we learned how to write programs that involve branching execution paths, using if-else statements and logical expressions. Unit 8 If-Else, Unit 9 Logical Expression were covered.

### Lecture 3

In this lecture, we got started with writing simple C programs that read inputs, perform some calculations, and display the result.

### Lecture 2

We covered Unit 3: functions and Unit 4: types.

In this lecture, we learned the concepts of functions, with which we can build up a more complex algorithm from smaller building blocks, such as finding the maximum. We also learned about the concept of types.

### Lecture 1

After some admin matters, we introduced what is a program, what is meant by programming, and what is computational problem solving.

We covered Unit 1: What is a Program? and Unit 2: Computational Problems and Algorithms in the first lecture.

## Programming Exercises

### Exercise 5: Square, Escape, MagicSquare

Released 31 October 2018

### Exercise 4: ID, Grade, Index, Max

Released 20 September 2018

### Exercise 3: Binary, Rectangle, Fibonacci, Prime

Released 13 September 2018

### Exercise 2: Leap, Suffix, Days

Released 6 September 2018

### Exercise 1: Freezer

Released 3 September 2018

## Programming Assignments

### Assignment 9: Digits

Released 9 November 2018. Due 16 November 2018, 23:59pm

### Assignment 8: Maze, Fill

Released 2 November 2018. Due 9 November 2018, 23:59pm

### Assignment 7: Peak, Scripts, Inversion

Released 26 October 2018. Due 2 November 2018, 23:59pm.

### Assignment 6: Permutation 1 2 3

Released 19 October 2018. Due 26 October 2018, 23:59pm.

### Assignment 5: Social, Life

Released 12 October 2018. Due 19 October 2018, 6pm.

### Assignment 4: SelectionSort, Add, Mastermind

Released 5 October 2018. Due 12 October 2018, 6pm.

### Assignment 3: Kendall, Histogram, CountingSort

Released 21 September 2018, Due 5 October 2018, 6pm.

### Assignment 2: Collatz, Weekday, Circle, Pattern

Released 14 September 2018, Due 21 September 2018, 6pm.

### Assignment 1: Invest, Box, Digits, and Taxi

Released 7 September 2018, Due 14 September 2018, 6pm.