SlideShare a Scribd company logo
1 of 17
A MOOC Course Report on
PROGRAMMING, DATA STRUCTURES AND ALGORITHMS USING PYTHON
Submitted by
KRIPANSHU SHEKHAR JHA (RA2011003030071)
Under the guidance of
PROFESSOR MADHAVAN MUKUND
Under the governing NPTEL body
of
BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE & ENGINEERING
of
FACULTY OF ENGINEERING AND TECHNOLOGY
SRM INSTITUTE OF SCIENCE & TECHNOLOGY,NCR CAMPUS
NOV 2022
 Add the image of the certificate
Course Outline
 Week 1: Introduction to Algorithms and Programming
 Week 2: Strings, Lists, Control Flow and Function
 Week 3: Manipulating list, break, Array vs List, Binary Search, Selection and Insertion Sort, and
Recursion
 Week 4: Merge Sort, Quick Sort, Tuples and Dictionaries
 Week 5: Exception Handling, Handling files
 Week 6: Backtracking, Nested Function, Sets, Stack and Queue
 Week 7: Abstract data type, Classes and Objects
 Week 8: Dynamic Programming and Memoization
Week 1: Introduction to Algorithms and Programming
 In this week we learned about algorithms and some
basics of programming.
 An algorithm is nothing but a set of rules that must be
followed while solving a problem. There are mainly 4
types of algorithms i.e. Brute Force, Greedy, Recursive
and Backtracking algorithm.
 In any programming language there are certain concepts
that we must know to do programming and write codes.
The basic concepts are variables, data structures, control
structures and syntax.
 We also learned about the gcd(Greatest common divisor) function which is used to
determine the greatest common divisor of the given two numbers and how to optimize
the brute force approach to reduce the computation time and have a better time
complexity.
 To optimize the function we use Euclid’s algorithm which is based on the below facts-
 1. If we subtract a smaller number from a larger one (we reduce a larger number), gcd
doesn’t change. So if we keep subtracting repeatedly the larger of two, we end up with
GCD.
 2. Now instead of subtraction, if we divide the smaller number, the algorithm stops
when we find the remainder 0.
Week 2: Strings, Lists, Control Flow and Function
 Learned about various data types like int, float and
bool. Int data type is used to store integer type values.
Float type values are used to store values that contain
decimal it them. And bool data type can only be used
to store either of the two values 0 and 1 that are also
considered as False and True values respectively.
 Strings are the data types that are used to store words
or sentences.
 Lists are very useful data types that are used to
maintain multiple elements of same or different type.
 Control flow is used to determine the flow of the
program. Certain if else statements or switch case
statements are used to control the flow of the code.
 If the condition statement specified is true then the
body of if statement is executed otherwise the
following else statement is executed if there is one.
Week 3: List, Binary Search, Selection and Insertion Sort, and Recursion
 Lists are a mutable data type in python which means
that once a list is created elements can be modified
and individual values can be replaced.
 Lists is used to collect items that usually consist of
elements of multiple data types. AN array is also a
vital component that collects several items of the
same data type.
 List cannot manage arithmetic operation whereas
array cam manage arithmetic operation.
 Binary search is a searching algorithm for finding an
element in a sorted array by repeatedly dividing the
search interval in half. In this the element is always
searched in the middle of the interval.
 Selection sort is an effective and efficient sort algorithm
based on comparison operations. It adds one element in
each iteration. You need to select the smallest element in
the array and move it to the beginning of the array by
swapping with the front element
 Insertion sort is a simple sorting algorithm that works
similar to the way you sort playing cards in your hands.
The array is virtually split into a sorted and an unsorted
part. Values from the unsorted part are picked and
placed at the correct position in the sorted part.
Week 4: Merge Sort, Quick Sort, Tuples and Dictionaries
 Merge sort is one of the most efficient sorting
algorithms. It is based on the divide-and-conquer
strategy. Merge sort continuously cuts down a list
into multiple sub lists until each has only one item,
then merges those sub lists into a sorted list.
 Quicksort is a divide-and-conquer algorithm. It
works by selecting a 'pivot' element from the array
and partitioning the other elements into two sub-
arrays, according to whether they are less than or
greater than the pivot. For this reason, it is
sometimes called partition-exchange sort.
 Tuples are used to store multiple items
in a single variable. Tuple is one of 4
built-in data types in Python used to store
collections of data, the other 3 are List,
Set, and Dictionary, all with different
qualities and usage. A tuple is a collection
which is ordered and unchangeable.
 Dictionary. Dictionaries are used to store
data values in key: value pairs. A
dictionary is a collection which is
ordered*, changeable and do not allow
duplicates. As of Python version 3.7,
dictionaries are ordered. In Python 3.6
and earlier, dictionaries are unordered.
Week 5: Exception Handling, Handling files
 Exceptions are raised when the program is syntactically
correct, but the code resulted in an error. This error does
not stop the execution of the program, however, it changes
the normal flow of the program. Try and except
statements are used to catch and handle exceptions in
Python. Statements that can raise exceptions are kept
inside the try clause and the statements that handle the
exception are written inside except clause.
 We should use Python’s inbuilt function open() but at the
time of opening, we have to specify the mode, which
represents the purpose of the opening file. f =
open(filename, mode)
 Where the following mode is supported:
1. r: open an existing file for a read operation.
2. w: open an existing file for a write operation. If the file
already contains some data then it will be overridden but if
the file is not present then it creates the file as well.
3. a: open an existing file for append operation. It won’t
override existing data.
4. r+: To read and write data into the file. The previous data
in the file will be overridden.
5. w+: To write and read data. It will override existing data.
6. a+: To append and read data from the file. It won’t override
existing data.
Week 6: Backtracking, Nested Function, Sets, Stack and Queue
 Backtracking is a form of recursion. But it involves choosing
only option out of any possibilities. We begin by choosing an
option and backtrack from it, if we reach a state where we
conclude that this specific option does not give the required
solution.
 Inner functions, also known as nested functions, are functions
that you define inside other functions. In Python, this kind of
function has direct access to variables and names defined in the
enclosing function. Inner functions have many uses, most notably
as closure factories and decorator functions.
 A stack is a linear data structure that stores items in a Last-
In/First-Out (LIFO) or First-In/Last-Out (FILO) manner. In
stack, a new element is added at one end and an element is
removed from that end only. The insert and delete operations are
often called push and pop.
 Like stack, queue is a linear data structure that stores items in
First In First Out (FIFO) manner. With a queue the least
recently added item is removed first. A good example of queue is
any queue of consumers for a resource where the consumer that
came first is served first.
Week 7: Abstract data type, Classes and Objects
 Abstract Data type (ADT) is a type (or class) for objects
whose behavior is defined by a set of values and a set of
operations. The definition of ADT only mentions what
operations are to be performed but not how these operations
will be implemented. It does not specify how data will be
organized in memory and what algorithms will be used for
implementing the operations. It is called “abstract” because
it gives an implementation-independent view.
 The process of providing only the essentials and hiding the
details is known as abstraction.
 A class is a code template for creating objects. Objects
have member variables and have behavior associated with
them. In python a class is created by the keyword class . An
object is created using the constructor of the class. This
object will then be called the instance of the class.
 An object is simply a collection of data (variables) and
methods (functions) that act on those data. Similarly, a
class is a blueprint for that object. We can think of a class
as a sketch (prototype) of a house. It contains all the details
about the floors, doors, windows, etc.
Week 8: Dynamic Programming and Memoization
 Dynamic Programming is mainly an optimization
over plain recursion. Wherever we see a recursive
solution that has repeated calls for same inputs, we
can optimize it using Dynamic Programming. The
idea is to simply store the results of subproblems,
so that we do not have to re-compute them when
needed later. This simple optimization reduces
time complexities from exponential to polynomial.
 For example, if we write simple recursive solution
for Fibonacci Numbers, we get exponential time
complexity and if we optimize it by storing
solutions of subproblems, time complexity reduces
to linear.
 Memoization is a technique of recording the
intermediate results so that it can be used to avoid
repeated calculations and speed up the programs. It
can be used to optimize the programs that use
recursion. In Python, memoization can be done with
the help of function decorators.
 Memoization allows you to optimize a Python
function by caching its output based on the
parameters you supply to it. Once you memoize a
function, it will only compute its output once for
each set of parameters you call it with. Every call
after the first will be quickly retrieved from a cache.
Kripanshu MOOC PPT - Kripanshu Shekhar Jha (1).pptx

More Related Content

Similar to Kripanshu MOOC PPT - Kripanshu Shekhar Jha (1).pptx

Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Sakthi Durai
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Sakthi Durai
 
Paradigms.pptx
Paradigms.pptxParadigms.pptx
Paradigms.pptxaikomo1
 
These questions will be a bit advanced level 2
These questions will be a bit advanced level 2These questions will be a bit advanced level 2
These questions will be a bit advanced level 2sadhana312471
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in pythonnitamhaske
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questionsAniketBhandare2
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questionsgokul174578
 
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptxrohithprabhas1
 
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II ajay pashankar
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptxSajalFayyaz
 
Technical_Interview_Questions.pdf
Technical_Interview_Questions.pdfTechnical_Interview_Questions.pdf
Technical_Interview_Questions.pdfadityashukla939020
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
 
Interview preparation for programming.pptx
Interview preparation for programming.pptxInterview preparation for programming.pptx
Interview preparation for programming.pptxBilalHussainShah5
 

Similar to Kripanshu MOOC PPT - Kripanshu Shekhar Jha (1).pptx (20)

Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Paradigms.pptx
Paradigms.pptxParadigms.pptx
Paradigms.pptx
 
These questions will be a bit advanced level 2
These questions will be a bit advanced level 2These questions will be a bit advanced level 2
These questions will be a bit advanced level 2
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questions
 
Python-Classes.pptx
Python-Classes.pptxPython-Classes.pptx
Python-Classes.pptx
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
 
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptx
 
Java Notes
Java NotesJava Notes
Java Notes
 
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptx
 
Technical_Interview_Questions.pdf
Technical_Interview_Questions.pdfTechnical_Interview_Questions.pdf
Technical_Interview_Questions.pdf
 
Oops
OopsOops
Oops
 
AI_2nd Lab.pptx
AI_2nd Lab.pptxAI_2nd Lab.pptx
AI_2nd Lab.pptx
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
set.pptx
set.pptxset.pptx
set.pptx
 
Interview preparation for programming.pptx
Interview preparation for programming.pptxInterview preparation for programming.pptx
Interview preparation for programming.pptx
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
 
Utility Classes
Utility ClassesUtility Classes
Utility Classes
 

Recently uploaded

Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Onlineanilsa9823
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 

Recently uploaded (20)

Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 

Kripanshu MOOC PPT - Kripanshu Shekhar Jha (1).pptx

  • 1. A MOOC Course Report on PROGRAMMING, DATA STRUCTURES AND ALGORITHMS USING PYTHON Submitted by KRIPANSHU SHEKHAR JHA (RA2011003030071) Under the guidance of PROFESSOR MADHAVAN MUKUND Under the governing NPTEL body of BACHELOR OF TECHNOLOGY in COMPUTER SCIENCE & ENGINEERING of FACULTY OF ENGINEERING AND TECHNOLOGY SRM INSTITUTE OF SCIENCE & TECHNOLOGY,NCR CAMPUS NOV 2022
  • 2.  Add the image of the certificate
  • 3. Course Outline  Week 1: Introduction to Algorithms and Programming  Week 2: Strings, Lists, Control Flow and Function  Week 3: Manipulating list, break, Array vs List, Binary Search, Selection and Insertion Sort, and Recursion  Week 4: Merge Sort, Quick Sort, Tuples and Dictionaries  Week 5: Exception Handling, Handling files  Week 6: Backtracking, Nested Function, Sets, Stack and Queue  Week 7: Abstract data type, Classes and Objects  Week 8: Dynamic Programming and Memoization
  • 4. Week 1: Introduction to Algorithms and Programming  In this week we learned about algorithms and some basics of programming.  An algorithm is nothing but a set of rules that must be followed while solving a problem. There are mainly 4 types of algorithms i.e. Brute Force, Greedy, Recursive and Backtracking algorithm.  In any programming language there are certain concepts that we must know to do programming and write codes. The basic concepts are variables, data structures, control structures and syntax.
  • 5.  We also learned about the gcd(Greatest common divisor) function which is used to determine the greatest common divisor of the given two numbers and how to optimize the brute force approach to reduce the computation time and have a better time complexity.  To optimize the function we use Euclid’s algorithm which is based on the below facts-  1. If we subtract a smaller number from a larger one (we reduce a larger number), gcd doesn’t change. So if we keep subtracting repeatedly the larger of two, we end up with GCD.  2. Now instead of subtraction, if we divide the smaller number, the algorithm stops when we find the remainder 0.
  • 6. Week 2: Strings, Lists, Control Flow and Function  Learned about various data types like int, float and bool. Int data type is used to store integer type values. Float type values are used to store values that contain decimal it them. And bool data type can only be used to store either of the two values 0 and 1 that are also considered as False and True values respectively.  Strings are the data types that are used to store words or sentences.  Lists are very useful data types that are used to maintain multiple elements of same or different type.  Control flow is used to determine the flow of the program. Certain if else statements or switch case statements are used to control the flow of the code.  If the condition statement specified is true then the body of if statement is executed otherwise the following else statement is executed if there is one.
  • 7. Week 3: List, Binary Search, Selection and Insertion Sort, and Recursion  Lists are a mutable data type in python which means that once a list is created elements can be modified and individual values can be replaced.  Lists is used to collect items that usually consist of elements of multiple data types. AN array is also a vital component that collects several items of the same data type.  List cannot manage arithmetic operation whereas array cam manage arithmetic operation.  Binary search is a searching algorithm for finding an element in a sorted array by repeatedly dividing the search interval in half. In this the element is always searched in the middle of the interval.
  • 8.  Selection sort is an effective and efficient sort algorithm based on comparison operations. It adds one element in each iteration. You need to select the smallest element in the array and move it to the beginning of the array by swapping with the front element  Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part.
  • 9. Week 4: Merge Sort, Quick Sort, Tuples and Dictionaries  Merge sort is one of the most efficient sorting algorithms. It is based on the divide-and-conquer strategy. Merge sort continuously cuts down a list into multiple sub lists until each has only one item, then merges those sub lists into a sorted list.  Quicksort is a divide-and-conquer algorithm. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub- arrays, according to whether they are less than or greater than the pivot. For this reason, it is sometimes called partition-exchange sort.
  • 10.  Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. A tuple is a collection which is ordered and unchangeable.  Dictionary. Dictionaries are used to store data values in key: value pairs. A dictionary is a collection which is ordered*, changeable and do not allow duplicates. As of Python version 3.7, dictionaries are ordered. In Python 3.6 and earlier, dictionaries are unordered.
  • 11. Week 5: Exception Handling, Handling files  Exceptions are raised when the program is syntactically correct, but the code resulted in an error. This error does not stop the execution of the program, however, it changes the normal flow of the program. Try and except statements are used to catch and handle exceptions in Python. Statements that can raise exceptions are kept inside the try clause and the statements that handle the exception are written inside except clause.
  • 12.  We should use Python’s inbuilt function open() but at the time of opening, we have to specify the mode, which represents the purpose of the opening file. f = open(filename, mode)  Where the following mode is supported: 1. r: open an existing file for a read operation. 2. w: open an existing file for a write operation. If the file already contains some data then it will be overridden but if the file is not present then it creates the file as well. 3. a: open an existing file for append operation. It won’t override existing data. 4. r+: To read and write data into the file. The previous data in the file will be overridden. 5. w+: To write and read data. It will override existing data. 6. a+: To append and read data from the file. It won’t override existing data.
  • 13. Week 6: Backtracking, Nested Function, Sets, Stack and Queue  Backtracking is a form of recursion. But it involves choosing only option out of any possibilities. We begin by choosing an option and backtrack from it, if we reach a state where we conclude that this specific option does not give the required solution.  Inner functions, also known as nested functions, are functions that you define inside other functions. In Python, this kind of function has direct access to variables and names defined in the enclosing function. Inner functions have many uses, most notably as closure factories and decorator functions.  A stack is a linear data structure that stores items in a Last- In/First-Out (LIFO) or First-In/Last-Out (FILO) manner. In stack, a new element is added at one end and an element is removed from that end only. The insert and delete operations are often called push and pop.  Like stack, queue is a linear data structure that stores items in First In First Out (FIFO) manner. With a queue the least recently added item is removed first. A good example of queue is any queue of consumers for a resource where the consumer that came first is served first.
  • 14. Week 7: Abstract data type, Classes and Objects  Abstract Data type (ADT) is a type (or class) for objects whose behavior is defined by a set of values and a set of operations. The definition of ADT only mentions what operations are to be performed but not how these operations will be implemented. It does not specify how data will be organized in memory and what algorithms will be used for implementing the operations. It is called “abstract” because it gives an implementation-independent view.  The process of providing only the essentials and hiding the details is known as abstraction.  A class is a code template for creating objects. Objects have member variables and have behavior associated with them. In python a class is created by the keyword class . An object is created using the constructor of the class. This object will then be called the instance of the class.  An object is simply a collection of data (variables) and methods (functions) that act on those data. Similarly, a class is a blueprint for that object. We can think of a class as a sketch (prototype) of a house. It contains all the details about the floors, doors, windows, etc.
  • 15. Week 8: Dynamic Programming and Memoization  Dynamic Programming is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of subproblems, so that we do not have to re-compute them when needed later. This simple optimization reduces time complexities from exponential to polynomial.  For example, if we write simple recursive solution for Fibonacci Numbers, we get exponential time complexity and if we optimize it by storing solutions of subproblems, time complexity reduces to linear.
  • 16.  Memoization is a technique of recording the intermediate results so that it can be used to avoid repeated calculations and speed up the programs. It can be used to optimize the programs that use recursion. In Python, memoization can be done with the help of function decorators.  Memoization allows you to optimize a Python function by caching its output based on the parameters you supply to it. Once you memoize a function, it will only compute its output once for each set of parameters you call it with. Every call after the first will be quickly retrieved from a cache.