You are on page 1of 19

PROGRAMMING, DATA-

STRUCTURES AND
ALGORITHMS USING
PYTHON
BY NAVNEET SINGH BHAKUNI
ROLL NO. -2271200

ROLL NO. -2271200

ROLL NO. -2271200


Certificate
Modules
1. Algorithms and Programming introduction Basic about Python
2. Various data structures, control flow statements and functions in
Python
3. Various Searching and Sorting Algorithms
4. Exception Handling and File handling
5. Backtracking, generating permutations
6. Basic about Memoization and Dynamic programming
About Python
Python Is High level, general-purpose and very popular programming
language. It was created by Guido van Rossum and released in 1991.

Python is being used in web development, Machine Learning


applications, along with all cutting-edge technology in Software
Industry.

Python language is being used by almost all tech-giant companies like


– Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
Algorithms and programming
• An algorithm consists of a sequence of steps which can we think of as a
recipe in order to achieve something.
• A program is a recipe that we write down using a programming
language.
• The goal of programming language is to be able to describe the
sequence of steps that are required and to also describe how we might
pursue different sequences of steps if different things happen in
between.
• Example- Algorithm for gcd(m,n).
Various Data-structures
• Basic types – int, float, bool.
• Advances types – Strings, Lists etc.
• These advanced types are further used to develop the more advance
data structures like trees and heaps.
• Mostly used data structure is list.
• Lists support various operations like slice, append, pop etc.
Control flow and functions
• Control flow statements like loops and conditional executions are
repeatedly used in designing various algorithms.
• A function is a group of statements which performs a given task.
Function is the backbone of any program. A function have the following
parts: name, parameters, return type and body.
• Functions simplify our task of writing enormous lines of code
repeatedly, thus we extensively use functions in designing tree and
heaps.
Searching and sorting algorithms
• This module include many searching and sorting algorithms.
• Some of the searching algorithms that we were introduced with :
• Binary search
• Linear search
• Sorting algorithms include:
• Selection sort
• Insertion sort
• Quick sort
• Merge sort
• Following slides depict some of the snapshots from the course videos showing
various sorting algos.
Binary Search
• It’s a divide and conquer paradigm of algorithm.
Quick Sort
• Quick Sort: The algorithm starts by selecting a pivot element (often
chosen as the first element of the list) and try moving it to its correct
position in the list by scanning the elements to its right and than to its
left.
Exception handling
➢ Types of errors:
a) Syntactical errors or Compile time errors: Wrong Python code.
b) Runtime Errors(Exceptions): Errors that occur while the code is being
executed.
File handling(I/O)
• Open a file – create a file handle on disk.
• Like setting up a buffer for a file

• Perform the desired read/write operation.

• Close the file


• Write out buffer to the disk(flush).
• Disconnect the file handle.
Back tracking & Generating Permutation
• Backtracking is an algorithmic technique for solving problems
recursively by trying to build a solution incrementally, one piece at a
time, removing those solutions that fail to satisfy the constraints of
the problem at any point of time (by time, here, is referred to the
time elapsed till reaching any level of the search tree).
• In backtracking we systematically search for a solution one step at a
time and when we hit a dead end we undo the last step and try the
next option.
• Backtracking is mostly used while generating permutations.
Memoization
• Memoization is a specific form of caching that is used in dynamic
programming.
• It basically stores the previously calculated result of the subproblem and
uses the stored result for the same subproblem. This removes the extra
effort to calculate again and again for the same problem.
Dynamic Programming
• Its an optimised version of memorised recursion. We do not have to go for inductive
recursive calls.
• It also follow the divide and conquer algorithm approach. As a problem is divided
into independent sub-problems and combining the results of the sub-problems.
Dynamic programming
Conclusions
• It was a great experience learning the new things from the
educator of INETRNSHALA -”Prof. ANAND MAHAJAN”.

• I would suggest to my juniors to pursue the courses from


INTERNSHALA, to enhance their knowledge and skills.
THANK
YOU

You might also like