CS 101: Computer Programming and Utilization



Course Information


Intended Audience and Pre-requisites

Intended for first year UG students.

Course Textbooks and Study Material


SSO Accessibility

For SSO accessible links, you should first go to google drive and use LDAPID@iitb.ac.in as the account to sign in. If you are already signed in through an IITB account, you will be able to access the SSO links right away. Otherwise, you will need to sign OUT of your personal gmail account and then enter your LDAPID@iitb.ac.in account. You will be taken to a page where you will need to enter your LDAP ID and password, and then enter an OTP which you will receive on the Google Authenticator app on your mobile phone. Once you enter the OTP, you are signed into SSO. Paste the SSO-accessible link into the same browser window and you will be able to access it.

Information for Labs

Installing Cygwin

Bodhitree page for CS 101

Online/Mobile Phone Based Compilation Environments for C++


Exam Schedule


Endsem (quiz 4): 9th Feb from 2 pm to 4 pm. Seating arrangement is here. Your exam room will be one of LA 001, LA 002, LA 201, LA 202, LH 101 of the lecture hall complex. Your group numbers can be found here.

Lecture Schedule

Date/Lecture No.

Lecture Content

Slides/Programs

1: Week from 31/10 to 4/11
  • Course overview
  • Simple cpp: basic turtle graphics
  • Programs to draw a square, regular decagon, regular n-gon
2: Week from 31/10 to 4/11
  • Concept of a variable and memory required for each
  • Different datatypes and operations on them, subtleties of division operation
  • Assignment operation, expression, overflow, roundoff
  • Accumulation and sequence generation: computing average, factorial, drawing a spiral
3: Week from 7/11 to 11/11
  • Quick overview: how to use nano editor, how to save a file, how to create a dictionary
  • Overview: how to compile a program and deal with syntax errors; how to use g++ and how to run an executable; use of Codeblocks
  • Program blocks and variable scope
  • Pre- and post increment and decrement operators, compound assignments
  • Use of a debugger, with gdb as an example
  • Numerical integration program
4: Week from 7/11 to 11/11
  • If and if else loops in C++
  • Switch cases in C++
  • Conditional/logical operators
  • While loops, differences between while and repeat loops, break and continue statements
5: Week from 14/11 to 18/11
  • While loops, differences between while and repeat loops, break and continue statements
  • For loops and do while loops
  • Caution against infinite loops

  • Numerical computing: least squares line fitting
6: Week from 14/11 to 18/11
  • GCD computation: slow and fast algorithms
  • Bisection method for root finding
  • Newton Raphson method for root finding
  • Gradient descent (not covered: will be covered later)
7: Week from 21/11 to 25/11
  • Concept of a function; return of variables in a function, void function
  • Call by value, call by reference
  • Examples of functions with call by value and call by reference
8: Week from 21/11 to 25/11
  • Global variables
  • Activation frames for a function
  • Revision of various concepts, usage of gdb
9: Week from 28/11 to 2/12
  • Pointers and references (not for quiz1)
  • Concept of a reference variable
  • Concept of pointers in C++
  • Some issues with pointers syntax

  • Recursive functions, importance of base case
  • Execution and activation frames
  • Examples of recursive functions: factorial computation, GCD computation

10: Week from 28/11 to 2/12
  • Execution and activation frames in case of recursive functions
  • Examples of recursive functions: efficient power computation, drawing a tree, drawing a fractal, Virahanka numbers
11: Week from 5/12 to 9/12
  • Concept of arrays in C++, array declarations, accessing array elements, range of array indices
  • Array indexing using pointers
  • Passing arrays to functions
  • Programs involving arrays: signal smoothing, histograms
12: Week from 5/12 to 9/12
  • Array declarations inside functions; Why not to explicitly return an array
  • Selection sort: algorithm, example, analysis of number of comparison operations
  • Linear search; binary search: recursive and non-recursive; analysis of number of comparison operations in linear and binary search in the worst case
13: Week from 19/12 to 23/12 (ONLY ONE LECTURE)
  • Bubble sort
  • Concept of time complexity and Big-O notation
  • Insertion sort
  • Character strings
14: Week from 26/12 to 30/12
  • Character strings: NULL character, string length, string copy, string concatenate, string reversal, string tokenizers (strtok function) with brief mention of applications
  • Auxiliary space complexity
  • Merge sort
15: Week from 26/12 to 30/12
  • Merge sort: time and space complexity
  • 2D arrays: declaration, dimensions and indexing: row and column, passing to functions, input and output
  • 2D arrays: arrays of character strings
  • Brief introduction to 3D arrays
16: Week from 2/1 to 6/1
  • Dynamic memory allocation: new and delete operator, difference between static and dynamic allocation, concept of memory leaks, dynamic memory allocation for 1D and 2D arrays, dynamic memory allocation and deallocation inside functions
17: Week from 2/1 to 6/1
  • Quick sort algorithm: Lomuto's partitioning method, recursive algorithm, time and space complexity, example

  • Structure: declaration, initialization, accessing structure elements
  • Pointer to structure, array of structures, passing structures to functions
18: Week from 9/1 to 13/1
  • Example program on polynomial addition using structures, arrays of structures and pointers to structures

  • Solutions to linear simultaneous equations: Gaussian elimination, concept of a pivot
19: Week from 9/1 to 13/1
  • Gradient descent for function minimization with fixed and adaptive step-size
20: Week from 16/1 to 20/1
  • Linked lists: concept, advantages and disadvantages as compared to arrays for data storage, methods to create, display, delete and modify a linked list, linked list reversal
21: Week from 16/1 to 20/1 Miscellaneous topics
  • Static variables and their usage
  • Measuring execution time
  • Random number generation
  • Pointers to functions
  • Function overloading
  • Function templates
22: Week from 23/1 to 27/1 Miscellaneous topics
  • Constant Pointers
  • Time complexity analysis of Euclid's algorithm for GCD computation

  • Classes in C++: data members, member functions
  • Public and private: access specifiers
  • Constructors
23: Week from 23/1 to 27/1
  • Private member functions
  • Constructors, copy constructors, destructors
  • Static data members and static functions
  • String class with dynamic memory allocation
24: Week from 31/1 to 3/2
  • Operator overloading concept
  • Overloading assignment operator, chained assignment operators
  • Overloading arithmetic operator, unary operator
  • Matrix class with dynamic memory allocation and deallocation in constructor and destructor respectively, copy constructor, operator overloading for matrix addition
25: Week from 31/1 to 3/2
  • Classes with templates, basic syntax
  • Matrix class with templates
  • Concept of a stack data structure, class for Stack, class for Stack with templates
  • Importance of overloading the = operator in the context of dynamic memory allocation and deallocation in a class