APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
(A State Government University)
SYLLABUS FORMAT (Theory + Lab courses)
For
B. Tech, 2024
Ambady Nagar
Thiruvananthapuram- 695016
Computer Science and Engineering (CS)
SEMESTER - 1
Algorithmic Thinking with Python
(Common to All Branches)
Course Code UCEST105 CIE Marks 40
Teaching Hours/Week (L: T:P: R) 3:0:2:0 ESE Marks 60
Credits 4 Exam Hours 2.30
Prerequisites (if any) None Course Type Theory+Lab
Course objectives:
● Provide a comprehensive understanding of algorithmic thinking, independent of any
programming language, and its practical applications. Provide a comprehensive understanding of
algorithmic thinking, and its practical applications, independent of any programming language.
● Explore algorithmic paradigms such as brute force, divide-and-conquer, dynamic programming,
and heuristics in solving complex problems
Syllabus
Contact Hours
(The focus should be on problem-solving, with Python just as a medium for illustration)
PROBLEM-SOLVING STRATEGIES:- Problem-solving strategies defined,
Importance of understanding multiple problem-solving strategies, Trial
and Error, Heuristics, Means-Ends Analysis, and Backtracking (Working
backward).
THE PROBLEM-SOLVING PROCESS:- Computer as a model of
computation, Understanding the problem, Formulating a model,
Module-I
Developing an algorithm, Writing the program, Testing the program, 7
and Evaluating the solution.
ESSENTIALS OF PYTHON PROGRAMMING:- Creating and using variables
in Python, Numeric and String data types in Python, Using the math
module, Using the Python Standard Library for handling basic I/O - print,
input, Python operators and their precedence.
ALGORITHM AND PSEUDOCODE REPRESENTATION:- Meaning and
Definition of Pseudocode, Reasons for using pseudocode, The main
constructs of pseudocode - Sequencing, selection (if-else structure, case
structure) and repetition (for, while, repeat-until loops), Sample
problems*
FLOWCHARTS** :- Symbols used in creating a Flowchart - start and end,
arithmetic calculations, input/output operation, decision (selection),
module name (call), for loop (Hexagon), flow-lines, on-page connector,
Module-II off-page connector.
_______________________________________________________________________________ 10
* - Evaluate an expression, d=a+b*c, find simple interest, determine the
larger of two numbers, determine the smallest of three numbers,
determine the grade earned by a student based on KTU grade scale (using
if-else and case structures), print the numbers from 1 to 50 in descending
order, find the sum of n numbers input by the user (using all the three loop
variants), factorial of a number, largest of n numbers (Not to be limited
to these exercises. More can be worked out if time permits).
APJ Abdul Kalam Technological University 1
Computer Science and Engineering (CS)
** Only for visualizing the control flow of Algorithms. The use of tools
like RAPTOR ([Link] is suggested.
Flowcharts for the sample problems listed earlier may be discussed
SELECTION AND ITERATION USING PYTHON:- if-else, elif, for loop,
range, while loop.
Sequence data types in Python - list, tuple, set, strings, dictionary,
Creating and using Arrays in Python (using Numpy library).
DECOMPOSITION AND MODULARISATION* :- Problem decomposition as
a strategy for solving complex problems, Modularisation, Motivation for
modularisation, Defining and using functions in Python, Functions with
multiple return values
RECURSION:- Recursion Defined, Reasons for using Recursion, The Call
Module- III 10
Stack, Recursion and the Stack, Avoiding Circularity in Recursion, Sample
problems - Finding the nth Fibonacci number, greatest common divisor of
two positive integers, the factorial of a positive integer, adding two positive
integers, the sum of digits of a positive number **.
______________________________________________________________________________
* The idea should be introduced and demonstrated using Merge sort, the
problem of returning the top three integers from a list of n>=3 integers as
examples. (Not to be limited to these two exercises. More can be
worked out if time permits).
** Not to be limited to these exercises. More can be worked out if time
permits.
COMPUTATIONAL APPROACHES TO PROBLEM-SOLVING(Introductory
diagrammatic/algorithmic explanations only. Analysis not required) :-
Brute-force Approach -
- Example: Padlock, Password guessing
Divide-and-conquer Approach -
- Example: The Merge Sort Algorithm
- Advantages of Divide and Conquer Approach
- Disadvantages of Divide and Conquer Approach
Dynamic Programming Approach
Module- IV - Example: Fibonacci series
- Recursion vs Dynamic Programming 10
Greedy Algorithm Approach
- Example: Given an array of positive integers each indicating the
completion time for a task, find the maximum number of tasks that
can be completed in the limited amount of time that you have.
- Motivations for the Greedy Approach
- Characteristics of the Greedy Algorithm
- Greedy Algorithms vs Dynamic Programming
Randomized Approach
- Example 1: A company selling jeans gives a coupon for each pair of
APJ Abdul Kalam Technological University 2
Computer Science and Engineering (CS)
jeans. There are n different coupons. Collecting n different coupons
would give you free jeans. How many jeans do you expect to buy
before getting a free one?
- Example 2: n people go to a party and drop off their hats to a hat-
check person. When the party is over, a different hat-check person is
on duty and returns the n hats randomly back to each person. What
is the expected number of people who get back their hats?
- Motivations for the Randomized Approach
APJ Abdul Kalam Technological University 3
Computer Science and Engineering (CS)
Course Assessment Method (CIE: -40 Marks, ESE: 60 Marks)
Continuous Internal Evaluation Marks (CIE):
Continuous Assessment Internal Internal Internal
(Accurate Execution of Examination-1 Examination-2 Examination- 3
Attendance Total
Programming Tasks) (Written (Written (Lab
Examination) Examination) Examination)
5 5 10 10 10 40
End Semester Examination Marks (ESE):
In Part A, all questions need to be answered and in Part B, each student can choose any one full question
out of two questions
Part A Part B Total
● 2 Questions from 2 questions will be given from each module, out of which 1 question
each module. should be answered. Each question can have a maximum of 3
● Total of 8 Questions, subdivisions. Each question carries 9 marks.
each carrying 3 (4x9 = 36 marks) 60
marks
(8x3 =24marks)
Course Outcomes (COs)
At the end of the course, the student will be able to:
Course Outcome Bloom’s
Knowledge
Level (KL)
CO1 Explore the role of a computer as a model of computation in solving real-world K2
problems.
CO2 Articulate a problem before attempting to solve it and prepare a clear and K3
accurate model to represent the problem.
CO3 Use effective algorithms to solve formulated models and translate algorithms K3
into executable programs.
CO4 Interpret the problem-solving strategies, a systematic approach to solving K2
computational problems, and essential Python programming skills
K1- Remember, K2- Understand, K3- Apply, K4- Analyse, K5- Evaluate, K6- Create
Course Articulation Matrix (Mapping of course outcomes with program outcomes):
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 3 3 3 3
CO2 3 3 3 3
CO3 3 3 3 3
CO4 3 3 3 3
1: Slight (Low), 2: Moderate (Medium), 3: Substantial (High), -: No Correlation
Textbooks
SL Name of the Edition
Title of the Book Name of the Author/s
No Publisher and Year
APJ Abdul Kalam Technological University 4
Computer Science and Engineering (CS)
Reference Books
Problem solving & programming Maureen Sprankle, Jim
1 Pearson 2012
concepts Hubbard
How to Solve It: A New Aspect of Princeton University
2 George Pólya 2015
Mathematical Method Press
Creative Problem Solving: An Donald Treffinger., Scott
3 Prufrock Press 2005
Introduction Isaksen, Brian Stead-Doval
Spielman, R. M., Dumper, K.,
4 Psychology (Sec.. Problem Solving.) Jenkins, W., Lacombe, A., H5P Edition 2021
Lovett, M., & Perlmutter, M
5 Computer Arithmetic Algorithms Koren, Israel AK Peters/CRC Press 2018
Introduction to Computation and
6 Guttag John V PHI 2/e., 2016
Programming using Python
Cay S. Horstmann, Rance D.
7 Python for Everyone Wiley 3/e, 2024
Necaise
Computational Thinking: A
G Venkatesh Mylspot Education 2020
8 Primer for Programmers and Data
Madhavan Mukund Services Pvt Ltd
Scientists
Video Links (NPTEL, SWAYAM etc):
[Link]
Module - I
[Link]
Module - II
Module - III
Module - IV
1. Continuous Assessment (5 Marks)
Accurate Execution of Programming Tasks
▪ Correctness and completeness of the program
▪ Efficient use of programming constructs
▪ Handling of errors
▪ Proper testing and debugging
2. Evaluation Pattern for Lab Examination (10 Marks)
1. Algorithm (4 Marks)
Algorithm Development: Correctness of the algorithm related to the question.
2. Programming (2 Marks)
Execution: Accurate execution of the programming task.
3. Result (2 Marks)
Accuracy of Results: Precision and correctness of the obtained results.
4. Viva Voce (2 Marks)
Proficiency in answering questions related to theoretical and practical aspects of the
subject.
APJ Abdul Kalam Technological University 5
Computer Science and Engineering (CS)
Sample Classroom Exercises:
1. Identify three ill-defined problems and well-defined problems
2. Identify five use cases for Trial and error, Heuristics, backtracking, and Means-ends analysis.
3. Use a diagram to solve the Tower of Hanoi for three pegs with the minimum number of moves.
4. Evaluate different algorithms discussed earlier based on their efficiency by counting the number of steps.
5. A recursive function that takes a number and returns the sum of all the numbers from zero to that number.
6. A recursive function that takes a number as an input and returns the factorial of that number.
7. A recursive function that takes a number ‘n’ and returns the nth Fibonacci number.
8. A recursive function that takes an array of numbers as input and returns the product of all the numbers in
the array.
9. A program to reverse the contents of an 1D array without using a second array.
10. To register for the end-semester examination, you need to log into the University portal with your
credentials. Write a program to validate the credentials. Assume that the usernames are stored in an array
of strings called USERNAME and the corresponding passwords are stored in another array of strings called
PASSWORD such that password[i] is the password for the user username[i].
11. You are given a list and your task is to divide it to make two smaller lists. The sublists should be made from
alternate elements in the original list. So if the original list is {5,1,4,12,6}, then one sublist should be {5,4,6}
and the other should be {1,12}.
12. A program that takes three points in 2D plane and determines whether they are collinear. Two pairs of points
are collinear if they have the same slope.
APJ Abdul Kalam Technological University 6
Computer Science and Engineering (CS)
SAMPLE LAB Experiments:
1. A simple desktop calculator using Python. Only the five basic arithmetic operators are to be considered.
2. Create, concatenate, and print a string and access a sub-string from a given string.
3. Familiarize time and date in various formats (Eg. “Thu Jul 11 10:26:23 IST 2024”)
4. Write a program to create, append, and remove lists in Python using NumPy.
5. Program to find the largest of three numbers.
6. Convert temperature values back and forth between Celsius (c), and Fahrenheit (f). [Formula: c/5 = f-32/9]
7. Program to construct the stars(*) pattern, using a nested for loop
8. A program that prints prime numbers less than N.
9. Program to find the factorial of a number using Recursion.
10. Recursive function to add two positive numbers.
11. Recursive function to multiply two positive numbers.
12. Recursive function to find the greatest common divisor of two positive numbers.
13. A program that accepts the lengths of three sides of a triangle as inputs. The program should output whether
or not the triangle is a right triangle (Recall from the Pythagorean Theorem that in a right triangle, the square
of one side equals the sum of the squares of the other two sides). Implement using functions.
14. Program to define a module to find Fibonacci Numbers and import the module to another program.
15. Program to check whether the given number is a valid mobile number or not using functions.
Rules:
1. Every number should contain exactly 10 digits.
2. The first digit should be 7 or 8 or 9
16. Input two lists from the user. Merge these lists into a third list such that in the merged list, all even numbers
occur first followed by odd numbers. Both the even numbers and odd numbers should be in sorted order.
17. Write a program to play a sticks game in which there are 16 sticks. Two players take turns to play the game.
Each player picks one set of sticks (needn’t be adjacent) during his turn. A set contains 1, 2, or 3 sticks. The
player who takes the last stick is the loser. The number of sticks in the set is to be input.
18. Suppose you're on a game show, and you are given the choice of three doors: Behind one door is a car;
behind the others, goats. You pick a door, say No. 1, and the host, who knows what is behind the doors,
opens another door, say No. 3, which has a goat. He then asks, "Do you want to pick door No. 2?" Is it to
your advantage to switch your choice?
(source:
[Link]
%20American%20Statistician%20in%201975.)
APJ Abdul Kalam Technological University 7