In Trimester 3, April - June 2021, I will be teaching CS 1100: Introduction to Programming.

### Administrative Information.

#### When and Where.

Classes are held online on Webex (password will be shared on Moodle) during the following hours.

#### Requirements.

#### Syllabus.

** Quiz 1: **

** Quiz 2: **

** Final: **
All of the above plus:

### Lecture Notes.

#### References.

Classes are held online on Webex (password will be shared on Moodle) during the following hours.

- Monday: 2 - 3:15 pm
- Tuesday: 3:25 - 4:40 pm
- Thursday: 10 - 10:50 am
- Friday: 9 - 9:50 am

- Assignments: 8 assignments, total weight 40%.
- Quiz 1 (May 03): 20%
- Quiz 2 (May 31): 20%
- Final (June 21): 20%

- Introduction to Computing, including basics of Computer Organization (CPU, ALU, etc.), Machine Lang/Assembly/High-level languages, and program compilation steps.
- Data representation (Decimal, Binary) of signed and unsigned integers (Sign-Magnitude, One's and Two's complement), floating point numbers - conversion from binary to decimal and vice-versa.
- Basic structure of C program including main() function.
- Variables and Constants, Assignment Statements, Operators -- Arithmetic, Logical, Relational, operator precedence).
- Input/output: Format-strings for printf and scanf.
- if-else statements

- Repetitive statements: while, do-while and for loops.
- Arrays: one dimensional, two-dimensional and three-dimensional arrays.
- Char data type, Strings and String Manipulation functions, Macros and Enum.
- Functions and Modular Programming.

- Recursive Functions
- Structures
- Pointers
- Searching algorithms: Linear and Binary search, where elements are stored in an array.
- Sorting algorithms: Selection and Insertion Sort, where elements are stored in an array.

Lecture | Topic | Reference |
---|---|---|

Lec 1 | Introduction to Programming. | Slides |

Lec 2 | More on Turtle. | Slides |

Lec 3 | The Computing Machine. | Slides |

Lec 4 | Our first C program. Basic data types, operators, keywords in C. | Slides |

Lec 5 | More details: operators, scanf, printf, sizeof, ranges of different datatypes. | Slides |

Lec 6 | Execution of Programs, Compilers. | Slides |

Lec 7 | Modifying the control flow in Programs. Arithmetic, relational and logical operators, precedence and associativity. Single selection (if). | Slides |

Lec 8 | Multiple selection switch. More examples of if-then-else. | Slides |

Lec 9 | First loop construct: while. | Slides |

Lec 10 | Revision. | No new slides |

Lec 11 | Quiz 1 | No slides |

Lec 12 | for loop, syntax, semantics, continue with for loop, examples. | Slides |

Lec 13 | Example problems: Mini calculator | Slides |

Lec 14 | More examples of loops: testing if a number is prime, finding prime numbers in interval, finding minimum, GCD. | Slides |

Lec 15 | Introduction to arrays, Manipulating integer and character arrays, Generating Histogram of Marks, Evaluating a polynomial. | Slides |

Lec 16 | Revision of loops: printing patterns, Printing first k primes, Finding prime factorization, Printing staircase of numbers, Computing positive square root of an integer, approximately. | Slides |

Lec 17 | Character Arrays, finding length of strings, comparing strings, palindromes, multi-dimensional arrays. | Slides |

Lec 18 | Character arrays and standard library support. Matrix operations: addition, multiplication, transpose, character grids, reversing an array. | Slides |

Lec 19 | More on character grids, introduction to functions, block and scope of variables. | Slides |

Lec 20 | More functions: factorial, finding sum, checking co-primeness, matrix multiplication, finding prime numbers, swapping numbers, binary to decimal conversion, Tic-Tac-Toe, character grids. | Slides |

Lec 21 | Tic-Tac-Toe, macros, enumerated constants, three dimensional arrays. | Slides |

Lec 22 | Revision. | No new slides |

Lec 23 | Quiz 2 | No slides |

Lec 24 | Recursive Functions : factorial, binomial coefficient, Virahanka/Fibonacci numbers, largest element in array. | Slides. We used this portal to visualise execution. |

Lec 25 | Searching: Linear and Binary search | Slides. This is the link we used to visualize the difference between linear and binary search. |

Lec 26 | More on Recursive Functions -- finding max recursively. Why one version is better than other? Binary search. Introduction to sorting. | Slides |

Lec 27 | Sorting: Selection and Insertion sort, overview of merge sort, introduction to pointers. | Slides |

Lec 28 | More on pointers. | Slides |

Lec 29 | Introduction to Structures. | Slides |

Lec 30 | More on Structures. | Slides |

Lec 31 | Wrapping up Structures. | Same slides as last class. |

Lec 32 | Course Summary and Takeaways. Revision of sorting, recursion. | Slides. |

Lec 33 | Revision of structures and pointers. | No new slides. |

Lec 34 | Holiday for self study. | No slides. |

Lec 35 | Final Exam. Best of luck! | No slides. |

- Paul Deitel and Harvey Deitel. C: How to Program.
- V. Rajaraman: Computer Programming in C.
- R. G. Dromey: How to Solve It By Computer?
- Kernighan and Ritchie: The C Programming Language.