You are on page 1of 53

Introduction to Programming and Data Structures Course(MMT-001)

S. Venkataraman
2nd February, 2008
1 / 17

Description.
I

Provides the programming knowledge required for the other Mathematics courses.

2 / 17

Description.
I

Provides the programming knowledge required for the other Mathematics courses. 4 Credit course.

2 / 17

Description.
I

Provides the programming knowledge required for the other Mathematics courses. 4 Credit course. 50% weightage for practicals.

I I

2 / 17

Description.
I

Provides the programming knowledge required for the other Mathematics courses. 4 Credit course. 50% weightage for practicals.

I I

2 / 17

Block 1
Introduction to C Programming.
I

Unit 1: Introduction to C.

3 / 17

Block 1
Introduction to C Programming.
I I

Unit 1: Introduction to C. Unit 2: Basic data types in C.

3 / 17

Block 1
Introduction to C Programming.
I I I

Unit 1: Introduction to C. Unit 2: Basic data types in C. Unit 3: C expressions.

3 / 17

Block 1
Introduction to C Programming.
I I I I

Unit 1: Introduction to C. Unit 2: Basic data types in C. Unit 3: C expressions. Unit 4: Decision structures in C.

3 / 17

Block 1
Introduction to C Programming.
I I I I I

Unit 1: Introduction to C. Unit 2: Basic data types in C. Unit 3: C expressions. Unit 4: Decision structures in C. Unit 5: Control Structures-I.
3 / 17

Block 2
I

Unit 6: Control structures.

4 / 17

Block 2
I I

Unit 6: Control structures. Unit 7: Pointers and arrays.

4 / 17

Block 2
I I I

Unit 6: Control structures. Unit 7: Pointers and arrays. Unit 8: Functions. Call by address using pointers.

4 / 17

Block 2
I I I

Unit 6: Control structures. Unit 7: Pointers and arrays. Unit 8: Functions. Call by address using pointers. Unit 9: Functions. Recursion.

4 / 17

Block 2
I I I

Unit 6: Control structures. Unit 7: Pointers and arrays. Unit 8: Functions. Call by address using pointers. Unit 9: Functions. Recursion. Unit10: Working with les. struct(). Bit elds.
4 / 17

I I

Data structures
I

Unit 11: Arrays

5 / 17

Data structures
I I

Unit 11: Arrays Unit 12: Lists

5 / 17

Data structures
I I I

Unit 11: Arrays Unit 12: Lists Unit 13: Stacks and queues

5 / 17

Data structures
I I I I

Unit 11: Arrays Unit 12: Lists Unit 13: Stacks and queues Unit 14: Trees

5 / 17

Data structures
I I I I I

Unit 11: Arrays Unit 12: Lists Unit 13: Stacks and queues Unit 14: Trees Unit 15: Files

5 / 17

Practical guide
I

Introduction to computers.

6 / 17

Practical guide
I I

Introduction to computers. Introduction to programming.

6 / 17

Practical guide
I I I

Introduction to computers. Introduction to programming. List of practical sessions.

6 / 17

Evaluation
I

70% weightage for term end examination, 30% weightage for continuous assessment.

7 / 17

Evaluation
I

70% weightage for term end examination, 30% weightage for continuous assessment. Continuous assessment: 20% for assignment, 10% internal assessment.

7 / 17

Evaluation
I

70% weightage for term end examination, 30% weightage for continuous assessment. Continuous assessment: 20% for assignment, 10% internal assessment. For the term end examination, 50% is for the practical examination, 20% for the theory examination.
7 / 17

Sessions.
I

2 Credits = 60 hours.

8 / 17

Sessions.
I I

2 Credits = 60 hours.
20 sessions of 3 hours each.

8 / 17

Sessions.
I I I

2 Credits = 60 hours.
20 sessions of 3 hours each.

At least 14 sessions are compulsory.

8 / 17

Instructions-I.
I

Create a separate folder in the computer you work on to store your programs.

9 / 17

Instructions-I.
I

Create a separate folder in the computer you work on to store your programs. Write the algorithm in pseudo code or make a ow chart.

9 / 17

Instructions-I.
I

Create a separate folder in the computer you work on to store your programs. Write the algorithm in pseudo code or make a ow chart. Check the algorithm for small values.

9 / 17

Instructions-I.
I

Create a separate folder in the computer you work on to store your programs. Write the algorithm in pseudo code or make a ow chart. Check the algorithm for small values. Write the program, compile, execute and debug.
9 / 17

I I

Instructions-I.
I

Create a separate folder in the computer you work on to store your programs. Write the algorithm in pseudo code or make a ow chart. Check the algorithm for small values. Write the program, compile, execute and debug.
9 / 17

I I

Pseudo Code example.


Algorithm (Euclid). Given two non-negative integers and b, this algorithm nds their GCD. 1. [Finished ?] If b = 0 then output as the answer and terminate the algorithm. 2. [Euclidean Step] Set r mod b, b, b r and go to step 1.
10 / 17

Instructions-II
I

Write down the program and algorithms neatly. Show the algorithm, the program and the output to your counsellor and get it signed.

11 / 17

Instructions-II
I

Write down the program and algorithms neatly. Show the algorithm, the program and the output to your counsellor and get it signed. Keep the signed algorithms/owcharts, results in a le. They will be used for internal assessment.
11 / 17

Instructions-II
I

Write down the program and algorithms neatly. Show the algorithm, the program and the output to your counsellor and get it signed. Keep the signed algorithms/owcharts, results in a le. They will be used for internal assessment.
11 / 17

Common errors
I

Using a , instead of ;

12 / 17

Common errors
I

Using a , instead of ; for ( i = 1, i < 100, i++)

12 / 17

Common errors
I

Using a , instead of ; for ( i = 1, i < 100, i++) Using a = instead of ==

12 / 17

Common errors
I

Using a , instead of ; for ( i = 1, i < 100, i++) Using a = instead of == if (remainder = 5)

12 / 17

Common errors
I

Using a , instead of ; for ( i = 1, i < 100, i++) Using a = instead of == if (remainder = 5) A ; at the end of for() or while().

12 / 17

Common errors
I

Using a , instead of ; for ( i = 1, i < 100, i++) Using a = instead of == if (remainder = 5) A ; at the end of for() or while().for ( i = 1; i < 100; i++);

12 / 17

Error Messages.
for ( i = 1, i < 100, i++) mistakes1.c:5:Warning:value computed is not used.

13 / 17

Error Messages.
for ( i = 1, i < 100, i++) mistakes1.c:5:Warning:value computed is not used. if (remainder = 5) mistakes1.c: In function main: mistakes1.c:7: warning: suggest parentheses around assignment used as truth value
13 / 17

Error Messages.
for ( i = 1, i < 100, i++) mistakes1.c:5:Warning:value computed is not used. if (remainder = 5) mistakes1.c: In function main: mistakes1.c:7: warning: suggest parentheses around assignment used as truth value
13 / 17

Precedence
if( count= Counter() || alphabet= Soup() ) Remember, when in doubt, use parenthesis:

14 / 17

Precedence
if( count= Counter() || alphabet= Soup() ) Remember, when in doubt, use parenthesis: if( (count= Counter()) || (alphabet= Soup()) )

14 / 17

Character constant Vs String


text = a;

15 / 17

Character constant Vs String


text = a; text = "a"; switch ( c ) { case a : puts ( " This i s case a " ) ; case b : puts ( " This i s case b " ) ; default : }
15 / 17

Debugging.
I

Use the option Wall to print warnings. With practice you will understand most of the error messages. Use printf() to print the intermediate values. Try explaining to your friend what the program is supposed to do.
16 / 17

Thank you!

THANK YOU!

CONTACT ADDRESS:svenkat@ignou.ac.in
17 / 17

You might also like