You are on page 1of 21

UNIT-1

Introduction:

Programs and Algorithms Features of an efficient algorithm Requirements for solving problems by computer Understand the Problem Formulate a Model Develop an Algorithm Write the Program

The Problem Solving Aspect :


Test the Program


Evaluate the Solution Breaking a problem in to sub problems

Top Down Design : Definition

Choice of a suitable data structure


Constructions of loops Establishing initial conditions for loops Finding the iterative construct

Terminations of loops

Implementation of Algorithms :

Use of procedures to emphasize modularity


Choice of variable name Documenting of programs Debugging Programs Program Testing & its explanation

Program Verification: :

Verification and Validation How Computer model for program execution is designed?

Input (I/P) and Output (O/P) Assertions(statement/ argument)


Implications and symbolic executions Verification of straight line program segments: Verification of program segments with branches Verification of program segment with loops Verification of program segments that employ arrays Proof of termination

Efficiency of algorithms: :

Types Redundant Computations Refactoring array elements Inefficiency due to late termination

Early detection of desired O/P Conditions


Trading Storage for efficiency gains

The analysis of Algorithms:


Why Algorithm analysis Computational Complexity The Order of Notation Worst and Average Case Behavior Probabilistic average case analysis

UNIT - II
Introduction to C Language Background, Simple C Programme, Identifiers, Basic data types, Variables, Constants, Input / Output, Operators. Expressions, Precedence and Associativity, Expression Evaluation, Type conversions, Bit wise operators, Statements, Simple C Programming examples. Selection Statements if and switch statements, Repetition statements while, for, do-while statements, Loop examples, other statements related to looping break, continue, goto, Simple C Programming examples.

Introduction to C Language Background: HISTORY Program Development Steps General Structure Example The four main components of C language are 1) The Character Set (letters, digits, special symbols) 2) Tokens (i. Keywords (32 auto,break,case,size of,struct,,void,volatile ) ii. Identifiers(names of variables by rules) iii. Constants: (a)Numerical Constants i. Integer Constant : 1. Decimal Constant , 2. Octal Constant 3. Hexadecimal Constant ii. Float Constant (b)Character Constants : i. Single Character Constant, ii. String Constant Backslash Character Constants [Escape Sequences]: \n,\b,\o,\f,\t,\v Format specifiers/ Delimiters : %c Print a character %d Print a decimalInteger %i Print a Signed decimal integer %e Print float value in exponential form. %f Print float value

iv. Punctuations(23 characters are used as punctuations in C. eg: + _ / ; : > ! etc)

v. Operators:

i. Arithmetic Operators : + - * / % ,ii. Assignment Operators : = , iii. Relational Operators: <><= >= == != ,iv. Logical Operators:! && || ,v. Conditional Operators: ! : ,vi. Increment& Decrement Operator : ++ --,vii. Bitwise Operator:!& | ~ ^ <<>> ,viii. Special Operator :sizeof ,(comma) 3) Variables(take on any value or a specified type 4) Data Types : Simple or Fundamental data type or primary data type or atomic data types --- int,char,float,double Derived data type combo of long,short,signed,unsigned with basic types User-defined data type (optional) enum,union,struct,typedef

Input / Output: Unformatted I/O functions:getchar(),putchar(),gets(),puts()

Formatted I/O functions:printf(),scanf()


Expressions: combination of variables constants and operators
Algebraic Expression axbc (m + n) (x + y) C Expression a*bc (m + n) * (x + y)

Precedence and Associativity: High priority * / %, Low priority + - (rules) Expression Evaluation: Expression is evaluated first and then replaces the previous value of the variable on the left hand side 9use rules increment / decrement) Type conversions: Implicit and explicit(casting) Bit wise operators: Logical Bitwise Operators, Shift bitwise Statements: conditional ,iterative and unconditional Selection Statements if ,if else,nested if,if else if ladder ,switch statements(multi-way decision making) ,Repetition statements while, for, do-while statements, jump

Order of Presentation: History Definition Usage Syntax Initialization Declaration Assignment Accessing types Functions Inter Function Communication Complex Functions Applications/characteristics pros & cons Examples

UNIT - III
Designing Structured Programmes, Functions, basics, user defined functions, inter function communication, Standard functions, Scope, Storage classes-auto, register, static, extern, scope rules, type qualifiers, recursion- recursive functions, Preprocessor commands, example C programmes Arrays Concepts, using arrays in C, inter function communication, array applications, two dimensional arrays, multidimensional arrays, C programme examples.

Designing Structured Programmes: about top down design Functions: Library functions(sqrt,pow,abs,floor,ceil,trunk,round) & user defined functions fun. Definition, fun. Call, fun. Declaration categories based on arguments and return values (4 types) Passing Parameters to Functions / Parameter Passing Mechanisms: call by value and call by reference

Inter function Communication :downward,upward,bidirectional


Recursion Preprocessor Commands:#include /#include< >,

Macro Definition-#define macro_name(<arg_list>) macro_body, Nested Macros

Undefining Macros: #define Val 30

#undef Val

#define val 50

Predefined Macros:_DATE_,_TIME_,_FILE_,_LINE_ Symbolic Constants: #define PI 3.14159 Conditional Compilation Commands: #if expression, #endif , #else , #elif , #ifdef name , #ifndef name

Scope(rules & scope,lifetime,visibility)


Storage classes-auto, register, static, extern type qualifiers: constant , volatile and restrict Arrays Concepts, using arrays in C inter function communication: Functions With Arrays / Passing arrays through functions , Array of Strings

UNIT - IV
Pointers Introduction (Basic Concepts), Pointers for inter function communication, pointers to pointers, compatibility, memory allocation functions, array of pointers, programming applications, pointers to void, pointers to functions, command line arguments. Strings Concepts, C Strings, String Input / Output functions, arrays of strings, string manipulation functions, string / data conversion, C programme examples.

Pointers Introduction (Basic Concepts): Pointer Constants ,Pointer Values,Pointer Variables The & Operator: The unary or monadic operator & gives the ``address of a variable''. The * Operator: The indirection or dereference operator gives the ``contents of an object pointed to by a pointer'' Types of Pointers: near,far,huge,null,wild,generic,dangling Pointer arithmetic Pointers for inter function communication: Pointers and Arrays[1D & 2D & n D ], Character pointer (or) Pointer and strings, Pointers And Functions (Pointer as function argument: (Call by Reference) , Pointer to Function: (Function Returning Pointers) ) , Pointers and Structures , Pointers To Pointers , Pointer to Void / Void Pointer, compatibility(poiinter of 1 data type storing into another format) , array of pointers, programming applications memory allocation functions:malloc,realloc,calloc,free command line arguments:- argc,argv Strings Concepts, C Strings, String Input / Output functions(printf,scanf,puts,gets), arrays of strings, string manipulation functions(strcat,strcpy,strlen,strstr,strcmp), string / data conversion(a to I, I to a, a to f)

UNIT - V
Derived types Structures Declaration, definition and initialization of structures, accessing structures, nested structures, arrays of structures, structures and functions, pointers to structures, self referential structures, unions, typedef, bit fields, enumerated types, C programming examples.

Derived types Structures: Tagged Structure ,Structure Variables , Typedef Structure Declaration, definition and initialization of structures, accessing structures(dot (.) operator, period operator ),Using DeReference Operator * , Using Selection Operator (->) ptr -> c or (*ptr).c ; ptr.i -> i or (*ptr).i; nested structures, arrays of structures, structures and functions, pointers to structures, self referential structures,

UNIT - VI
Input and Output Concept of a file, streams, standard input / output functions, formatted input / output functions, text files and binary files, file input / output operations, file status functions (error handling), C programme examples.

Input and Output(stdio.h) Concept of a file(buffer and stream), streams(text and binary), standard input / output functions(stdin & stdout) formatted input / output(printf,scanf,getchar,putchar,gets,p uts) functions, text files and binary files, file input / output operations(fprintf,fscanf,fopen,fclose,fget c,fputc,fgets,fputs,fread,fwrite, file status functions (ftell,fseek,rewind), system file operations(fflush,rename,remove), error handling(feof (),ferror (),clearerr ())

UNIT VII
Searching and Sorting Sortingselection sort, bubble sort, insertion sort, quick sort, merge sort, Searchinglinear and binary search methods , Trees : representation , tree traversals.

Searching and Sorting Sortingselection sort, bubble sort, insertion sort, quick sort, merge sort, Searching-linear and binary search methods Trees : representation(preliminaries like level,depth,height,root,leaf,node,siblings, path,length,degree) Tree traversals(inorder,preorder,postorder,lev el order),representation of binary tree using linked and linear representation, Binary tree: Full binary tree, complete binary tree, strictly binary tree, binary search tree,BFS,DFS.

UNIT - VIII
Data Structures Introduction to Data Structures, abstract data types, Linear list singly linked list implementation, insertion, deletion and searching operations on linear list, StacksOperations, array and linked representations of stacks, stack application-infix to postfix conversion, postfix expression evaluation, recursion implementation, Queues-operations, array

Data Structures Introduction to Data Structures, abstract data types, Linear list singly linked list implementation, insertion, deletion and searching operations on linear list, Stacks-Operations, array and linked representations of stacks, stack application-infix to postfix conversion, postfix expression evaluation, recursion implementation, Queues-operations, array and linked representations.

You might also like