You are on page 1of 67

Contents

1. Lab Safety Policies...........................................................................................................................3


2. General lab safety..............................................................................................................................3
3. Clothing:.............................................................................................................................................3
4. Equipment Failure.............................................................................................................................3
5. Electrical safety..................................................................................................................................3
6. Fire......................................................................................................................................................4
7. In Case of emergency.........................................................................................................................4
8. Safety Undertaking..........................................................................................................................5
9. Grading Policy..................................................................................................................................6
10. Rubrics..............................................................................................................................................6
11. Level of Inquiry..............................................................................................................................11
12. Lab’s Course Learning Outcomes................................................................................................12
13. List of Experiments........................................................................................................................13
I. Lab Safety Policies

1. General lab safety:


 Never eat or drink while working in the lab.
 Read labels carefully.
 Do not use any equipment unless you are trained and approved as a user by your
supervisor.
 Never do unauthorized experiments.
 Never work alone in laboratory.
 Keep your lab space clean and organized.
 Do not leave an on-going experiment unattended.

2. Clothing:
 Shorts and sandals should not be worn in the lab at any time. Shoes are required when
working in the machine shops.
 If you have long hair or loose clothes, make sure it is tied back or confined.
 Keep the work area clear of all materials except those needed for your work.

3. Equipment Failure:
 If a piece of equipment fails while being used, report it immediately to Lab
Engineer/Assistant. Never try to fix the problem yourself because you could harm
yourself and others.
 If leaving a lab unattended, turn off all ignition sources and lock the doors.
 Clean up your work area before leaving.

4. Electrical safety:
 Obtain permission by the safety coordinator before operating any high voltage equipment
 Maintain an unobstructed access to all electrical panels.
 Avoid using extension cords whenever possible.
 Never, ever modify or otherwise change any high voltage equipment.

5. Fire
:  If a person’s clothing catches on fire, he/she needs help.
 Prevent him/her from running.
 M n and smother the flames by rolling, wrapping with lab coats, blankets,
a towels, etc.
k
 Never turn a carbon dioxide extinguisher on a person.
e
h  If a fire breaks out, (if time allows) turn off all burners and remove solvents, place
i the chemical and equipment safely to the nearest possible table/bench, exit the
m building calmly.
/
h  If you do not use the fire extinguisher, leave the room immediately to a safer
e place possibly outside. There are carbon dioxide extinguishers in the building and
r the positions and operation of these should be known.
li
 Point the extinguisher at the base of the flames.
e
d  Very small fires can be put out with a damp towel by smothering.
o
w  Only after the safety of all is assured should the matter of extinguishing the fire be
considered.
Because a few seconds delay can result in very serious injury, Laboratory staff will guide you on
what to do and how to exit during the case of such an emergency.

6. In Case of emergency
 Report the location of the emergency; give your name, telephone number, and
building and floor number.
 Report the nature of the emergency whether an explosion has occurred and
whether there has been a chemical or electrical fire.
RESCUE: 1122
Police Emergency Control Room: 041-9200264
Army Control Room: 1135
Administrator: 041-8777210
Safety Undertaking

I HAVE READ ALL OF THE ABOVE, AND I AGREE TO CONFIRM TO ITS


CONTENTS.

Name: M. Usman Zafar Course: DSA

Student ID: BEE-FA19-039 Section: 2019-23

Signature: Lab: CS Lab

Date:

Lab Instructor:
II. Grading Policy
Lab Performance 20%
Lab Report 10%
Lab Project 20%
Final Lab Viva/ Performance 50%

Rubrics
Lab Performance (Continuous Assessment)
S
r.
# Performance
Exemplary (5) Satisfactory (4-3) Developing(2-1) Unsatisfactory (0)
Indicator
Fully understand the Has very good Has some Has poor
lab instruments understanding of the understanding of the understanding of the
including its lab instruments lab instruments lab instruments
purpose and quite including its purpose including its purpose including its
Ability to able to conduct the and able to conduct and able to conduct purpose and unable
1 entire experiment experiment with to conduct
Conduct experiment with many
Experiment with negligible help some help from lab help from lab experiment on his
from lab instructor. instructor. instructor. own; lab instructor.

Always analyses Analyses and Analyses Analyses and


and interprets interprets data and interprets data
data correctly correctly most of interprets incorrectly most
and precisely; the time; most of data of the time;
always draws the conclusion correctly many
correct and are correct and occasionally conclusions are
2 Data Analysis useful useful; compares ; some incorrect; most
& conclusions; theory against conclusion of the time never
Interpretation always compares experimental are attempts to
theory against results and incorrect; compare theory
experimental calculates occasionally against
results and related error compares experimental
calculates related most of the time. theory results.
error. against
experiments
and results.
Reports/ Assignment

Sr. Performance Unsatisfactory (0)


# Exemplary (5) Satisfactory (4-3) Developing(2-1)
Indicator

Information is presented Information is Information is Sequence of


in a logical, interesting presented in presented in quite less information is
way, which is easy to somewhat logical continuity and less difficult to follow. No
follow. All sections are manner. All sections logical manner. logical manner or
1
Organization in a correct order and are in a correct order Sections are not in continuity. Objective,
Structure submitted on a time. as directed and proper order as directed results and
submitted on a time. unable to follow the Conclusion are not
submission deadline. stated.
or
Unable to submit
the lab report.

Calculations are Calculations are quite Calculations are Most of the


completely logical logical and somewhat logical and calculations are
and systematic. systematic. systematic. Results and inaccurate. No
Results and Results and conclusion are stated but logical and
conclusion are stated conclusion are stated reflect little knowledge systematic
and reflect complete and reflect acceptable of the experiment. calculations.
2 Calculations knowledge of the knowledge of the Data presentation is Presents data in a
and Data experiment. Presents experiment. Presents not that clear. very obscure manner.
Presentation data very clearly using data appropriate
Graphs/waveforms, Graphs/wave
appropriate graphs/waveforms.
graphs/waveforms. Figure captions and figure captions and forms, figure
Figure captions and units are included units are not always captions and units
units are always most of the time. included. are never included.
included. or
Unable to
submit the lab
report.
Viva Voce
Sr
.#
Performance Unsatisfactory
Exemplary (5) Satisfactory (4-3) Developing(2-1)
Indicator
(0)

Responsiveness to Responds well, quick Generally responsive Responsive but evasive Non-responsive.
Questions / and very accurate all and accurate most of or inaccurate most of the
Accuracy the time. the times. times.
1

Level of Demonstration of At ease with Only basic No grasp of


Understanding full knowledge of content and concepts are information.
2 of the learned the subject with able to demonstrated Clearly no
skills explanations and elaborate and and knowledge of
elaboration. explain to interpreted. subject matter. No
some degree. questions are
answered. No
interpretation
made.
IV. Level of Inquiry

Level Problem/ Question Procedure/ Method Solution


0 Provided to student Provided to student Provided to student
1 Provided to student Provided to student Constructed by student
2 Provided to student Constructed by student Constructed by student
3 Constructed by student Constructed by student Constructed by student

Level of Description
inquiry

The problem, procedure, and methods to solutions are provide to the Student.
0 The student performs the experiment and verifies the results with the manual.

The problem and procedure are provide to the student. The student
1 Interprets the data in order to propose viable solutions.

The problem is provide to the student. The student develops a procedure for
2 investigating the problem, decides what data to gather, and interprets the data
in order to propose viable solutions.

A “raw” phenomenon is provide to the student. The student chooses (or


3 constructs) the problem to explore, develops a procedure for investigating the
problem, decides what data to gather, and interprets the data in order to propose
viable solutions
Department of Electrical Engineering
The University of Faisalabad.
V. Lab’s Course Learning Outcomes

Course Title : Data Structure and Algorithm


Course Code : EE-213
Instructor : Sir Usama Assad
Designation : Lecturer
Phone (Off.) : __________________

Program Learning Outcomes (PLO):-

PLO1: Engineering Knowledge PLO2: Problem Analysis

PLO3: Design/Development of Solutions PLO4: Investigation

PLO5: Modern Tool Usage PLO6: The Engineer and Society

PLO7: Environment and Sustainability


PLO8: Ethics

PLO9: Individual and Team work PLO10: Communication

PLO11: Project Management PLO12: Lifelong Learning


Department of Electrical Engineering
The University of Faisalabad.
Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab titles : Data Structures & Algorithms using python.

1 Installation of IDEs
Task 1: Installation Of Python IDE,
Task 2: How to start with jupyter installation
Task 3: Implementing Distance formula & Pythagoras theorem.
2 Write a program that
 prints out the decimal equivalents of 1/2, 1/3, 1/4, 1/10.
 using a for loop that loops over a sequence.
 Interpreter and Sum of 2 Numbers On CMD Using Python
Language.
3 Working with data types:
 Defining variables with assignment operator “=”.
 Create variables with different data types.
 Using type() function to determine data types.
 Compare variables with comparison operator “==”.
 Convert variable from one data type to another.
 Work with integers, floats & complex numbers.
 Understand the Boolean data type and implement
AND,NOT,OR,XOR & NAND tables using Boolean logic.
While loop, Continue-Break & if else statements in Python.
4 Introduction to Lists:
 Write a Python program to sum all the items in a list.
 Write a Python program to get the smallest number from a list.
 Write a Python program to map two lists into a dictionary.
5 Introduction to Tuple:
 Write a Python program to convert a list to a tuple.
 Write a Python program calculate the product, multiplying all the
Department of Electrical Engineering
The University of Faisalabad.
numbers of a given tuple.
6 Introduction to Strings:
 Write a Python program to count the number of strings where the
string length is 2 or more and the first and last character are same
from a given list of strings.
 Write a Python program to create a dictionary from a string.
7 Working With For Loops:
Write a Python program to iterate over dictionaries using for loops
8 Write a Python program to generate a 3*4*6 3D array whose each
element is *.
9 Write a Python program to find maximum and the minimum value in a
set.
1 Working with NumPy.
0
1 OOP in Python, Working with Classes:
1  Create a Car class with two instance attributes.
1. .color , which stores the name of the car’s color as a string.
2. .mileage ,which stores the number of miles of the car as an
integer.
1 Sorting techniques implementation in Python.
2 Implementation of
 Bubble Sort
 Selection Sort
 Insertion Sort
 Shell Sort
1 Open Ended Lab
3 Task: To develop a program in python to get a certain process that output
a number after doing comparison among three different loops based on
user defined logic.
You have to write the code for calling that process through a function
method. Once called your function method should be able to complete
above procedure and also find time complexity of the program.
Department of Electrical Engineering
The University of Faisalabad.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 1: Installation of IDEs

Objectives:
Task 1: Installation Of Python IDE,
Task 2: How to start with jupyter installation
Task 3: Implementing Distance formula & Pythagoras theorem.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________


Department of Electrical Engineering
The University of Faisalabad.

Task No 01: Installation of Python IDE.


Procedure:
 First I can download the Pycharm Python IDE from this Link.
https://www.jetbrains.com/pycharm/download/#section=windows

 When I can download the Pycharm then I can start the Installation. I click the next button.

 I can select the location where the Pycharm will install.


Department of Electrical Engineering
The University of Faisalabad.

 I can select the create shortcut and path variable option.

 Installation will start.


Department of Electrical Engineering
The University of Faisalabad.

 I select the reboot later option.

 Finally, the Pycharm will start.


Department of Electrical Engineering
The University of Faisalabad.

 Now it’s time to install Python Interpreter from web: https://www.python.org/downloads/

 Download the file and click to install. Click on install now.


Department of Electrical Engineering
The University of Faisalabad.
 The installation will start.

 The Setup was successfully install.

 Installation Finished, let’s start it by printing Hello World.


Department of Electrical Engineering
The University of Faisalabad.

 Enter the following code in IDE and put some space before x2 in line 3.

 Now Run the code, it will give an Indentation error.

 To remove this error remove the space before x2 and write the code in the same alignment.
Department of Electrical Engineering
The University of Faisalabad.
Task No 02: How to start with Jupyter Installation.
Procedure:
 Firstly I download anaconda.
 To download anaconda open chrome and type anaconda .
 A link shown in a figure1.1

No table of figures entries found.

 Clik on this link .


 Fig 1.2 shown on your screen.

Fig 1.2
 Click on produts showing in fig 1.2 and then click on individual product
showing in fig 1.3
Department of Electrical Engineering
The University of Faisalabad.

Fig 1.3
 Click on individual edition and then click on download showing in fig 1.4

Fig 1.4
 A new page shown in fig 1.5
 Click on 64 bit graphicall installer and download anaconda
Department of Electrical Engineering
The University of Faisalabad.

Fig 1.5

Task No 03: Implementing Distance Formula & Pythagoras Theorem.


Procedure: For Distance Formula
 Enter the following code in IDE.

 Now Run the code and input the values.


Department of Electrical Engineering
The University of Faisalabad.

 The code will run successfully.

Procedure: For Pythagoras Theorem


 Enter the following code in IDE.

 Now Run the code and input the values.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 02: Programming in Python

Objectives:
Write a program that
 Prints out the decimal equivalents of 1/2, 1/3, 1/4, 1/10.
 Using a for loop that loops over a sequence.
 Interpreter and Sum of 2 Numbers On CMD Using Python Language.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________


Department of Electrical Engineering
The University of Faisalabad.

Task No 01: Using a for loop, write a program that prints out the decimal
equivalents of 1/2, 1/3, 1/4, 1/10.
Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Task No 03: Using a for loop, write a program that loops over a sequence.

Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

Task No 01: Print the python file in cmd window.


Department of Electrical Engineering
The University of Faisalabad.
Procedure:
 Enter the following code in IDE and save the file as sum.py.

 Now give the command (Window + R) and write cmd.

 When cmd window open we write the file name as we save sum.py.

 Now, input the values as we want to sum. They will give output.
Department of Electrical Engineering
The University of Faisalabad.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth


Department of Electrical Engineering
The University of Faisalabad.
Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 03: Working with data types:

Objectives:
 Defining variables with assignment operator “=”.
 Create variables with different data types.
 Using type() function to determine data types.
 Compare variables with comparison operator “==”.
 Convert variable from one data type to another.
 Work with integers, floats & complex numbers.
 Understand the Boolean data type and implement
AND,NOT,OR,XOR & NAND tables using Boolean logic.
While loop, Continue-Break & if else statements in Python.
RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Gates in Python:
AND gate:
Department of Electrical Engineering
The University of Faisalabad.
Procedure:
 Enter the following code in IDE.
def AND (a, b):
    if a == 1 and b == 1:
        return True
    else:
        return False
# Driver code
if __name__=='__main__':
    print(AND(1, 1))
    print("+---------------+----------------+")
    print(" | AND Truth Table | Result |")
    print(" A = False, B = False | A AND B =",AND(False,False)," | ")
    print(" A = False, B = True | A AND B =",AND(False,True)," | ")
    print(" A = True, B = False | A AND B =",AND(True,False)," | ")
    print(" A = True, B = True | A AND B =",AND(True,True)," | ")
 Now run the code.

 The code will run successfully.

OR gate:
Department of Electrical Engineering
The University of Faisalabad.
Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

NOT gate:
Procedure:
Department of Electrical Engineering
The University of Faisalabad.
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

NAND gate:
Procedure:
Department of Electrical Engineering
The University of Faisalabad.
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

XOR gate:
Procedure:
Department of Electrical Engineering
The University of Faisalabad.
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth


Department of Electrical Engineering
The University of Faisalabad.
Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 04: Introduction to Lists:

Objectives:
 Write a Python program to sum all the items in a list.
 Write a Python program to get the smallest number from a list.
 Write a Python program to map two lists into a dictionary.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Task No 01: Write a Python program to sum all the items in a list.
Department of Electrical Engineering
The University of Faisalabad.
Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

Task No 02: Write a Python program to get the smallest number from a list.

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Task No 03: Write a Python program to map two lists into a dictionary.

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 05: Introduction to Tuple.


Department of Electrical Engineering
The University of Faisalabad.
Objectives:
 Write a Python program to convert a list to a tuple.
 Write a Python program calculate the product, multiplying all the numbers of a
given tuple.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Task No 01: Write a Python program to convert a list to a tuple.

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

  The code will run successfully.

Task No 02: Write a Python program calculate the product, multiplying all the
numbers of a given tuple.

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 06: Introduction to Dictionary:


Department of Electrical Engineering
The University of Faisalabad.
Objectives:
 Write a Python program to count the number of strings where the string length
is 2 or more and the first and last character are same from a given list of
strings.
 Write a Python program to create a dictionary from a string.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Task No 01: Write a Python program to count the number of strings where the string
length is 2 or more and the first and last character are same from a given
list of strings.

Procedure:
Department of Electrical Engineering
The University of Faisalabad.
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.

Task No 02: Write a Python program to create a dictionary from a string..

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.


Department of Electrical Engineering
The University of Faisalabad.
Lab No 07: Working With For Loops:

Objectives:
 Write a Python program to iterate over dictionaries using for loops.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.


Department of Electrical Engineering
The University of Faisalabad.
Lab No 08: Program to generate a 3*4*6 3D array whose each element is *.

Objectives:
 Write a Python program to generate a 3*4*6 3D array whose each element is
*.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.


Department of Electrical Engineering
The University of Faisalabad.
Lab No 09: Program to find maximum and the minimum value in a set.

Objectives:
 Write a Python program to find maximum and the minimum value in a set.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.

 Now run the code.

 The code will run successfully.

Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.


Department of Electrical Engineering
The University of Faisalabad.
Lab No 10: Working with NumPy.

Objectives:
 Implementing Num.Py
RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________

Procedure:
 Enter the following code in IDE.
Department of Electrical Engineering
The University of Faisalabad.
Department of Electrical Engineering
The University of Faisalabad.
Department of Electrical Engineering
The University of Faisalabad.
Department of Electrical Engineering
The University of Faisalabad.
Department of Electrical Engineering
The University of Faisalabad.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 11: OOP in Python, Working with Classes.

Objectives:
Create a Car class with two instance attributes.
 .Car , which stores the name of the car’s name as a string
 .Color , which stores the name of the car’s color as a string.
 .miles ,which stores the number of miles of the car covered as an integer.

RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________


Department of Electrical Engineering
The University of Faisalabad.
Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 12: Sorting techniques implementation in Python.

Objectives:
Implementation of
 Bubble Sort
 Selection Sort
 Insertion Sort
 Shell Sort
RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________


Department of Electrical Engineering
The University of Faisalabad.
Bubble Sort
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent
elements if they are in wrong order.

Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Selection Sort
The selection sort algorithm sorts an array by repeatedly finding the minimum element
(considering ascending order) from unsorted part and putting it at the beginning. The algorithm
maintains two subarrays in a given array.

Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Insertion Sort
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.

Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Shell Sort
Shellsort, also known as Shell sort or Shell's method, is an in-place comparison sort. It can be seen
as either a generalization of sorting by exchange (bubble sort) or sorting by insertion
(insertion sort). The running time of Shellsort is heavily dependent on the gap sequence it uses.

Procedure:
 Enter the following code in IDE.

 Now run the code.

 The code will run successfully.


Department of Electrical Engineering
The University of Faisalabad.
Program: Bachelor of Electrical Engineering Semester: 4rth

Subject: Data Structures & Algorithms by Python Date: 20-05-2021.

Lab No 13: Open Ended Lab

Objectives:
To develop a program in python to get a certain process that output a
number after doing comparison among three different loops based on user
defined logic.
You have to write the code for calling that process through a function
method. Once called your function method should be able to complete above
procedure and also find time complexity of the program.
RUBRICS

Performance Lab
Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Experiment 10 Organization/Structure 05
Related
Knowledge
Data 10 Data Presentation 05
analysis
Total Marks
Obtained

Remarks (if any): ______________________

Name & Signature of faculty: _____________


Department of Electrical Engineering
The University of Faisalabad.
Procedure:
 Enter the following code in IDE.

def minimum_number():
list1 = []
for i in range(0,250):
import random
n1 = random.randint(0,250)
#print(n)
list1.append(n1)
print ("Random list 1: ",list1)

list2 = []
for j in range(0,250):
import random
n2 = random.randint(0, 250)
# print(n)
list2.append(n2)
print ("Random list 2: ",list2)

list3 = []
for k in range(0,250):
import random
n3 = random.randint(0, 250)
# print(n)
list3.append(n3)
print ("Random list 3: ",list3)

list_f = []
ent = int(input("Enter the index number : "))
list_f.append(list1[ent])
list_f.append(list2[ent])
list_f.append(list3[ent])
print (" ")
print("This is the most Smallest value of required index number : ",
min(list_f))
print("Done")
print (" ")

print (minimum_number())
Department of Electrical Engineering
The University of Faisalabad.
 Now run the code.

 The code will run successfully.

You might also like