[go: up one dir, main page]

0% found this document useful (0 votes)
107 views12 pages

Lab Manual

The document outlines the contents of a lab manual for an electrical engineering course on data structures and algorithms, including a list of 7 lab experiments covering topics like sorting algorithms, recursion, asymptotic notation, and data structures implemented with lists, stacks, queues and linked lists. The manual provides learning outcomes, experiment titles, dates and space to record marks for each completed lab session.

Uploaded by

Asad Khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views12 pages

Lab Manual

The document outlines the contents of a lab manual for an electrical engineering course on data structures and algorithms, including a list of 7 lab experiments covering topics like sorting algorithms, recursion, asymptotic notation, and data structures implemented with lists, stacks, queues and linked lists. The manual provides learning outcomes, experiment titles, dates and space to record marks for each completed lab session.

Uploaded by

Asad Khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

NED University of Engineering & Technology

Department of Electrical Engineering

LAB MANUAL

Data Structures and Algorithms


(EE-264)
For
SE Electrical

Instructor name: Dr. Mirza Muhammad Ali Baig


Student name: Muhammad Tariq Khalid
Roll no: EE-21031 Batch: 2021

Semester: Fall (Third) Year: 2022-23


To be filled by lab technician

Attendance: Present out of Lab sessions

Attendance Percentage

To be filled by Lab Instructor

Lab Score Sheet

Roll No. Rubric Rubric Rubric Rubric Rubric Rubric OEL/PBL Final LAB Attendance Final weighted Score for
based based based based based based Rubric Rubric Percentage MIS System
Lab I Lab II Lab III Lab IV Lab V Lab VI Score Score [10(A)+10(B)+5(C)]/25
A B C Round to next higher
multiple of 5

EE-264 DSA Rubric Based Labs: 3, 4, 5, 8, 9, 10

Note: All Rubric Scores must be in the next higher multiple of 5 for correct entry in MIS system.
LAB MANUAL

Data Structures and Algorithms


(EE-264)
For
SE Electrical

Content Revision Team: Dr. Riaz Uddin and Dr. Mirza Muhammad Ali Baig

Last Revision Date: 28th December 2020

Approved By

The Board of Studies of Department of Electrical Engineering


CONTENTS

CLO (Psychomotor, Level 3): Students should build various basic algorithms, analyze empirically their
growth of computational time and formulate object-oriented programming to develop basic data-structures

CLO (Affective, Level 2): Students should build various basic algorithms, analyze empirically their
growth of computational time and formulate object-oriented programming to develop basic data-structures

Total
S. No. Date Title of Experiment Signature
Marks
07-Nov-22
1 Introduction to programming with Python

14-Nov-22
2 Developing and executing algorithms using Python

21-Nov-22 To analyze the efficiency of sorting algorithms


3

28-Nov-22 To develop and apply the recursive divide and conquer


4
approach in sorting
12-Dec-22 Extending the divide-and-conquer approach on sorting
5
and searching problems
19-Dec-22
6 Apply Asymptotic Notations to the Sorting Algorithms.

26-Dec-22
7 Introduction to object oriented programming.

02-Janc-23 Develop a system which can perform basic


8
banking related tasks
-09-Jan-23 To implement fundamental data structures in Python
9 (using list)
a) Stack
b) Queue
16-Janc-23 Accomplish the following open-ended tasks:

Using Node class, develop


10
1. Stacks

2. Queue

25-Janc-23 Accomplish the open-ended task:


11 Using Node class, develop Singly connected
linked-list
Laboratory Session No. 02
TASK 1:
Write a program which could generate the following pattern. [Hint: use ‘end’ option in print command]

n=int(input("Number: "))
for i in range(n):
for j in range(i):
print('*',end='')
print()
for i in range(n):
for j in range(i,n):
print('*',end='')
print()
OUTPUT:
TASK 2:
Write a program which can generate the following:

n=int(input("Input a number: "))


count=1
while count<=10:
print(n,'X',count,'=',n*count)
count=count +1
OUTPUT:
TASK 3:
Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error
message. If the score is between 0.0 and 1.0, print a grade using the following table:

>= 0.9 A
>= 0.8 B
>= 0.7 C
>= 0.6 D
< 0.6 F

try:
n =float(input("Enter score: "))
if n>=0.9 and n<=1.0:
print("A")
elif n>=0.8 and n<0.9:
print("B")
elif n>=0.7 and n<0.8:
print("C")
elif n>=0.6 and n<0.7:
print("D")
elif n>=0.0 and n<0.6:
print("F")
else:
print("Bad Score")
except:
print("Bad Score")
OUTPUT:
TASK 4:
Re-write the above program using functions.

n =input("Enter score: ")


def grade(n):
try:
if n>=0.9 and n<=1.0:
print("A")
elif n>=0.8 and n<0.9:
print("B")
elif n>=0.7 and n<0.8:
print("C")
elif n>=0.6 and n<0.7:
print("D")
elif n>=0.0 and n<0.6:
print("F")
else:
print("Bad Score")
except:
print("Bad Score")
grade(n)
OUTPUT:

TASK 5:
Write a Python function to calculate the factorial of a number. [Use recursive approach]
num=int(input("Please enter the number to get factorial :"))
s=1
for i in range (num,1,-1):
s=s*i
print(i,"x ",end="")
print("1 = ",s)
OUTPUT:

TASK 6:
Write a function which can search for an entry in a list. Also show the entry count in the list.

a=[1,4,5,8,9,87,67,54,3,2]
key=int(input("Enter key:"))
def search(a,key):
for i in range(0,len(a)):
if a[i]==key:
return i
d=search(a,key)
print("Entry found at",d)
OUTPUT:

TASK 7:
Develop code in python for sorting a list using selection sort approach. In selection sort you find the
minimum value first and place it at the end of the list.

a=[1,4,5,8,9,87,67,54,3,2]
key=int(input("Enter key:"))
def search(a,key):
for i in range(0,len(a)):
if a[i]==key:
return i
d=search(a,key)
print("Entry found at",d)
OUTPUT:
Laboratory Session No. 03

You might also like