SEMESTER S1
ALGORITHMIC THINKING WITH PYTHON –1
(Group A)
Course Code UCST105 CIEMarks 40
Teaching Hours/Week
3:0:2:0 ESE Marks 60
(L: T:P: R)
Credits 3 Exam Hours 2 Hrs.30 Min.
None
Prerequisites(if any) Course Type Theory
Course Objectives:
1. Provide a comprehensive understanding of algorithmic thinking and its practical applications.
2. Explore algorithmic paradigms including brute force, divide-and-conquer,
dynamic programming and heuristics in solving complex problems.
SYLLABUS
Modul Hours
e Syllabus Description
PROBLEM-SOLVING STRATEGIES AND PROCESS: -
Problem-solving strategies defined. Computer as a model of computation,
Understanding the problem, Formulating a model, Developing an algorithm,
Writing the program, Testing and Evaluating the program.[Refer Textbook 1
1
& 2]
9
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).
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, off-page
connector.
[Refer Textbook 3]
ESSENTIALS OF PYTHON PROGRAMMING:- Creating and
using variables in Python, Numeric and String data types in Python,
2 Using the math module, Using the Python Standard Library for 9
handling basic I/O - print, input, Python operators and their
precedence.
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).
[Refer Textbook 4 ,5 &7]
DECOMPOSITION AND MODULARIZATION* :- Problem
decomposition as a strategy for solving complex problems,
Modularization, Motivation for modularization, Defining and using
functions in Python, Functions with multiple return values
3 RECURSION:- Recursion Defined, Reasons for using Recursion, The
Call Stack, Recursion and the Stack, Avoiding Circularity in 9
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 **.
[Refer Textbook 4 ,5 &7]
COMPUTATIONAL APPROACHES TO PROBLEM-
SOLVING
(Introductory diagrammatic/algorithmic explanations only, Analysis
not required):-
Divide-and-Conquer Approach: Introduction, Advantages and 9
Disadvantages, Example: The Merge Sort Algorithm
4 Dynamic Programming Approach: Introduction, Recursion vs
Dynamic Programming, Example: Fibonacci series.
Greedy Algorithm Approach: Motivations for the Greedy Approach
Characteristics of the Greedy Algorithm, Greedy Algorithms vs
Dynamic Programming, Example: Task Completion Problem.
[Refer Textbook 6]
Course Assessment Method (CIE: 40 marks, ESE: 60 marks)
Continuous Internal Evaluation Marks (CIE):
Continuous Internal Internal Internal
Attendance Assessment Examination-1 Examination-2 Examination- 3 Total
(Accurate (Written (Written (Lab Examination)
Execution of Examination) Examination)
Programming
Tasks)
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 each ● Each question carries 9 marks.
module. ● Two questions will be given from each
● Total of 8 Questions, each module, out of which 1 question should be
carrying 3 marks answered.
● Each question can have a maximum of 3 60
(8x3 =24 marks)
subdivisions.
(4x9 = 36 marks)
Course Outcomes (COs)
At the end of the course students should be able to:
Bloom’s
Course Outcome Knowledge Level
(KL)
Utilize computing as a model for solving real-world problems.
CO1 K2
Articulate a problem before attempting to solve it and prepare a clear and
CO2 accurate model to represent the problem. K3, K4
Utilize effective algorithms to solve the formulated models and translate
CO3 algorithms into executable programs. K3, K4
Interpret the problem-solving strategies, a systematic approach to solving
CO4 computational problems, and essential Python programming skills K3
Note: K1- Remember, K2- Understand, K3- Apply, K4- Analyse, K5- Evaluate, K6- Create
CO-PO Mapping Table:
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. 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 (2 Marks)
Algorithm Development: Correctness and efficiency of the algorithm related to the question.
2. Programming (3 Marks)
Execution: Accurate execution of the programming task.
3. Result (3 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.
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 a 2D plane and determines whether they are collinear.
Two pairs of points are collinear if they have the same slope.
LAB Experiments:
1. Simple desktop calculator using Python. Only the five basic arithmetic operators.
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 patterns of stars (*), 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]
Reference Books
Edition and
Sl. No Title of the Book Name of the Author/s Name of the Publisher
Year
1 Creative Problem Solving: An Donald Treffinger., Scott
Introduction Isaksen, Brian Stead-Doval Prufrock Press 2005
Spielman, R. M., Dumper,
2
Psychology (Sec. K., Jenkins, W., Lacombe,
H5P Edition 1/e., 2021
Problem Solving.) A., Lovett, M., &
Perlmutter, M
3 Computer Arithmetic Algorithms Koren, Israel AK Peters / CRC Press 2018
Introduction to Computation and
4 Guttag John V
Programming Using Python PHI 2/e.,2016
Cay S. Horstmann, Rance
5 Python for Everyone Wiley 3/e., 2024
D. Necaise
Computational Thinking : A Primer G Venkatesh
6 for Programmers and Data Mylspot Education
1/e., 2020
Madhavan Mukund Services Private Limited
Scientists
Ajeesh Ramanujan & Human Resource
Algorithmic Thinking with Python Development Centre ,
7 2024
Narasimhan T APJ Abdul Kalam
Technological University
Video Links (NPTEL, SWAYAM…)
Module No. Link ID
1 [Link]
2 [Link]