L T P C CSE18R171 Programming for Problem Solving 3 1 2 5 Pre-requisite: Basic Computer Knowledge at School Course Category: Basic Engineering Level Course Type: Integrated Course Course Objective(s): To make the students to understand the basic concepts of programming language, rules to be followed while writing a program and how to compile and execute C programs. Course Outcome(s): At the end of the course, the student will be able to: CO1: Understand the basic programming concepts and syntax of C language CO2: Develop efficient code using pointers, arrays and dynamic memory allocation techniques CO3: Create user defined data types and functions to solve given problems. CO4: Design an efficient algorithm for a given problem CO5: Build efficient code to solve the real-world problem CO6: Elucidate the programming constructs of C during interviews Mapping of Course Outcome(s): PO PSO CO 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 CO1 H M H CO2 H M M L H M CO3 H M M M H M CO4 H M M M H M CO5 H H M M H M CO6 L L L L L L L Course Topics: UNIT 1: INTRODUCTION TO PROGRAMMING Introduction to components of a computer system (disks, memory, processor, where a program is stored and executed, operating system, compilers etc.), Idea of Algorithm: steps to solve logical and numerical problems. Representation of Algorithm: Flowchart/ Pseudocode with examples, from algorithms to programs; source code, variables (with data types) variables and memory, locations, Syntax and Logical Errors in compilation, object and executable code, Arithmetic expressions and precedence, Conditional Branching and Loops, Writing and evaluation of conditionals and consequent branching, Iteration and loops. UNIT 2: ARRAYS AND STRINGS Introduction - One dimensional and two-dimensional arrays – Declaration of arrays – Initializing and Accessing array elements – Strings: One dimensional character arrays - Declaration and String Initialization - String Manipulation - Multidimensional Arrays - Arrays of Strings UNIT 3: BASIC ALGORITHMS Searching, Basic Sorting Algorithms (Bubble, Insertion and Selection), Finding roots of equations, notion of order of complexity through example programs (no formal definition required) UNIT 4: FUNCTION Functions (including using built in libraries), Parameter passing in functions, call by value, passing arrays to functions: idea of call by reference, Recursion, Recursion, as a different way of solving problems. Example programs, such as Finding Factorial, Fibonacci series, Ackerman function etc. Quick sort or Merge sort. UNIT 5: STRUCTURE, POINTERS & FILE HANDLING Structures, defining structures and Array of Structures, Idea of pointers, defining pointers, Use of Pointers in self-referential structures, notion of linked list (no implementation), File handling (only if time is available, otherwise should be done as part of the lab) TEXT BOOKS 1. Byron Gottfried, “Schaum's Outline of Programming with C”, McGraw Hill India, 2010 2. E. Balagurusamy, “Programming in ANSI C”, McGraw Hill India, 2012 REFERENCE BOOKS 1. Brian W. Kernighan and Dennis M. Ritchie, “The C Programming Language”, PHI India, 2009 LIST OF EXPERIMENTS Tutorial 1: Problem solving using computers: Lab 1: Familiarization with programming environment Tutorial 2: Variable types and type conversions: Lab 2: Simple computational problems using arithmetic expressions Tutorial 3: Branching and logical expressions: Lab 3: Problems involving if-then-else structures Tutorial 4: Loops, while and for loops: Lab 4: Iterative problems e.g., sum of series Tutorial 5: 1D Arrays: searching, sorting: Lab 5: 1D Array manipulation Tutorial 6: 2D arrays and Strings Lab 6: Matrix problems, String operations Tutorial 7: Functions, call by value: Lab 7: Simple functions Tutorial 8 &9: Numerical methods (Root finding, numerical differentiation, numerical integration): Lab 8 and 9: Programming for solving Numerical methods problems Tutorial 10: Recursion, structure of recursive calls Lab 10: Recursive functions Tutorial 11: Pointers, structures and dynamic memory allocation Lab 11: Pointers and structures Tutorial 12: File handling: Lab 12: File operations