Thursday, 28 May 2020

What is Python? Why do we learn Python? How we learn Pyhton?

1.What is Python? 

 

 

 

 

 

1. Simplicity: Python has made programming fun because it's simple

2. Open Source: It is free for anyone to use. Modification in python is also allowed

3. Portability: Write your code and you can share your anyone u want.

4. Extendible & Extensible: Python supports adding code of other languages.

5. Interpreted: Management of memory, CPU and debugging the code is simpler

6. Huge Libraries: python has a huge library support which helps you in problem

7. Object Orientation: Python supports oops

 

2.Why do we learn Python? 

 

 

 

 

3.How we learn Python?

Tuesday, 26 May 2020

How to create a Menu driven Program in Python

How to create a Menu driven Program in Python..

Step 1. Open your python command prompt.
Step 2. Write the following code into it.
Step 3. Execute it / Test the output for various inputs.
Step 4. Now move towards the study parts of python like how to declare and define function in python.
Step 5. To study function more in detail please click on the following link

 The code to write in Step 2 are as follows:
(base) C:\Users\Admin>python
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Ana
conda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def mainMenu():
...  print("1. Adition")
...  print("2. Substraction")
...  print("3. Exit")
...  choice=int(input("Enter u r choice"))
...  if choice==1:
...   add()
... elif choice==2:
  File "<stdin>", line 8
    elif choice==2:
       ^
SyntaxError: invalid syntax   Note: indentation of code is too much important in python otherwise you will get error like this.

 # Following is the code of main function in python.
>>> def mainMenu():
...  print("1. Adition")
...  print("2. Substraction")
...  print("3. Exit")
...  choice=int(input("Enter u r choice"))
...  if choice==1:
...   add() #when choice is equals to 1 we call add() function from mainMenu()
...  elif choice==2:
...   sub() #when choice is equals to 2 we call sub() function from mainMenu()
...  elif choice==3:
...   exit  #when choice is equals to 3 we call exit function from mainMenu()
...  else:
...   print("Invalid choice, Enter valid choice1-3")
...   mainMenu()
...# to come out from function press two times Enter key.

# To call mainMenu function for execution.
>>> mainMenu()
1. Adition
2. Substraction
3. Exit
Enter u r choice5   # here we are testing our code for invalid input.
Invalid choice, Enter valid choice1-3
1. Adition
2. Substraction
3. Exit
Enter u r choice3   # for valid inputs its works fine




# Definition of add() function that is actual logic of addition function how it behaves after calling.
>>> def add():
...  print("Enter no1:")
...  x=int(input())
...  y=int(input("Enter no2:"))
...  z=x+y
...  print("The add is:",z)
...  mainMenu()
...
>>>  mainMenu()  # space is not allowed while calling function
  File "<stdin>", line 1
    mainMenu()
    ^
IndentationError: unexpected indent

>>> mainMenu()
1. Adition
2. Substraction
3. Exit
Enter u r choice1 #Execution or calling of sub() function
Enter no1:
2
Enter no2:2
The add is: 4
1. Adition
2. Substraction
3. Exit
Enter u r choice4
Invalid choice, Enter valid choice1-3
1. Adition
2. Substraction
3. Exit
Enter u r choice3


 
# Definition of sub() function that is actual logic of substraction function how it behaves after calling.
>>> def sub():
...  a=int(input("enter no1"))
...  b=int(input("enter no2"))
...  print("The sub is:",a-b)
...  mainMenu()
...
>>> mainMenu()
1. Adition
2. Substraction
3. Exit
Enter u r choice2 #Execution or calling of sub() function
enter no120
enter no210
The sub is: 10
1. Adition
2. Substraction
3. Exit
Enter u r choice3
>>>






Monday, 25 May 2020

Syllabus: (2019 Course) Fundamentals of Data Structures (FDS)

SECOND YEAR COMPUTER ENGINEERING (2019 COURSE) A. Y : 2020-2021

Note: ROUGH SYLLABUS YET NOT FINALISE:

Savitribai Phule Pune University Second Year of Computer Engineering (2019 Course) 

210242: Fundamentals of Data Structures 

Teaching Scheme:  TH: 03 Hours/Week
Credit: 03
Examination Scheme:  Mid_Semester(TH): 30 Marks
                                       End_Semester(TH): 70 Marks

Unit I Introduction to Algorithm and Data Structures (07 Hrs)

Introduction: From Problem to Data Structure (Problem, Logic, Algorithm, and Data Structure). Data Structures: Data, Information, Knowledge, and Data structure, Abstract Data Types (ADT), Data Structure Classification (Linear and Non-linear, Static and Dynamic, Persistent and Ephemeral data structures) Algorithms: Problem Solving, Introduction to algorithm, Characteristics of algorithm, Algorithm design tools: Pseudo-code and flowchart Complexity of algorithm: Space complexity, Time complexity, Asymptotic notation- Big-O, Theta and Omega, Finding complexity using step count method, Analysis of programming constructs-Linear, Quadratic, Cubic, Logarithmic.
Algorithmic Strategies- Introduction to algorithm design strategies- Divide and Conquer, and Greedy strategy.
#Exemplar/Case Studies
Multiplication technique by the mathematician Carl Friedrich Gauss and Karatsuba algorithm for fast multiplication.

Unit II Linear Data Structure Using Sequential Organisation (07 Hrs)


Concept of Sequential Organisation, Overview of Array, Array as an Abstract Data Type, Operations on Array, Merging of two arrays, Storage Representation and their Address Calculation: Row major and Column Major, Multidimensional Arrays: Two-dimensional arrays, n-dimensional arrays. Concept of Ordered List, Single Variable Polynomial: Representation using arrays, Polynomial as array of structure, Polynomial addition, Polynomial multiplication. Sparse Matrix: Sparse matrix representation using array, Sparse matrix addition, Transpose of sparse matrix- Simple and Fast Transpose, Time and Space tradeoff. 
#Exemplar/Case Studies Study use of sparse matrix in Social Networks and Maps. Study how Economists use polynomials to model economic growth patterns, how medical researchers use them to describe the behaviour of Covid-19 virus.

Unit III Searching and Sorting (06 Hrs)

Searching: Search Techniques-Sequential Search/Linear Search, Variant of Sequential Search- Sentinel Search, Binary Search, Fibonacci Search, and Indexed Sequential Search. Sorting: Types of Sorting-Internal and External Sorting, General Sort Concepts-Sort Order, Stability, Efficiency, and Number of Passes, Comparison Based Sorting Methods-Bubble Sort, Insertion Sort, Selection Sort, Quick Sort, Shell Sort, Non-comparison Based Sorting Methods-Radix Sort, Counting Sort, and Bucket Sort, Comparison of All Sorting Methods and their complexities.
 #Exemplar/Case Studies Use of Fibonacci search in non-uniform access memory storage and in Optimization of Unimodal Functions. Timsort as a hybrid stable sorting algorithm

Unit IV Linked List (07 Hrs)


Introduction to Static and Dynamic Memory Allocation, Linked List: Introduction, of Linked Lists, Realization of linked list using dynamic memory management, operations, Linked List as ADT, Types of Linked List: singly linked, linear and Circular Linked Lists, Doubly Linked List, Doubly Circular Linked List, Primitive Operations on Linked List-Create, Traverse, Search, Insert, Delete, Sort, Concatenate. Polynomial Manipulations-Polynomial addition. Generalized Linked List (GLL) concept, Representation of Polynomial using GLL.
 #Exemplar/Case Studies Garbage Collection.

Unit V Stack (07 Hrs)

Basic concept, stack Abstract Data Type, Representation of Stacks Using Sequential Organization, stack operations, Multiple Stacks, Applications of Stack- Expression Evaluation and Conversion, Polish notation and expression conversion, Need for prefix and postfix expressions, Postfix expression evaluation, Linked Stack and Operations. Recursion- concept, variants of recursion- direct, indirect, tail and tree, Backtracking algorithmic strategy, use of stack in backtracking. #Exemplar/Case Studies Android- multiple tasks/multiple activities and back-stack , Tower of Hanoi, 4 Queens problem.

Unit VI Queue (06 Hrs)

Basic concept, Queue as Abstract Data Type, Representation of Queue using Sequential organization, Queue Operations, Circular Queue and its advantages, Multi-queues, Linked Queue and Operations. Deque-Basic concept, types (Input restricted and Output restricted), Priority Queue- Basic concept, types(Ascending and Descending). 
#Exemplar/Case Studies Priority queue in bandwidth management.

Learning Resources

Text Books: 
 Horowitz and Sahani―Fundamentals of Data Structures in C++, University Press, ISBN 10: 0716782928 ISBN 13: 9780716782926. 
 Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser, Data Structures and Algorithms in Python, Wiley Publication, ISBN: 978-1-118-29027-9

Reference Books: 
1. Brassard & Bratley ―Fundamentals of Algorithmic Prentice Hall India/Pearson Education, ISBN 13-9788120311312. 
2. Allen Downey, Jeffery Elkner, Chris Meyers-How to think like a Computer Scientist: Learning with Python, Dreamtech Press, ISBN:9789351198147. 
3. R. Gillberg, B. Forouzn ―Data Structures: A Pseudo code approach with C, Cenage Learning, ISBN: 9788131503140. 
4. M. Weiss―Data Structures and Algorithm Analysis in C++, 2nd edition, Pearson Education, 2002, ISBN-81-7808-670-0.

Other: 
 Know Thy Complexities! (https://www.bigocheatsheet.com/) (https://github.com/RehanSaeed/.NET-Big-O-Algorithm-Complexity-Cheat-Sheet) 
 Data Structure Visualizations (https://www.cs.usfca.edu/~galles/visualization/Algorithms.html)