0% found this document useful (0 votes)
21 views3 pages

Lab Assignment No 1

Uploaded by

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

Lab Assignment No 1

Uploaded by

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

Lab Assignment #1.

: Course: Data Structures and Algorithm (CSC211) Class: BDS-


3/A/Semester Fall-2024_______
Marks: 10 Teacher Name: Dr.Samera Batool

Name: __________________________ Roll No ____________________

Submission Deadline: 20-09-2024

CLO 4: Implement data structures and algorithms.

Perform the following Lab tasks.


Lab Task 1 Write a function that takes an integer and then returns the number with the digits
reversed. For example, if the input is 12345, the output should be 54321.
int reverseInteger(int value)
{………
}
Lab Task 2 Write a function that takes two integers as input and returns the largest from these
two input numbers.
int maximum(int a, int b)
{
……
}
Task 3 Write a function which takes an integer argument value and displays the weekday
corresponding to that number. E.g. 1 for Monday, 2 for Tuesday,… 7 for Sunday, on any other
number it should print wrong input is provided.
Input: 3
Output: Wednesday
Lab Task 4 Use for loop to print this diamond shape.

Lab Task 5 Marks of a student in five different subjects are given as following [90,60,80,50,60]
Write a program to calculate average, and overall grade according to this criteria: Marks Grade.
85% and above A
70% to 84% B
60% to 69% C
50% to 59% D
Below 50% F
Note: use user-defined functions
LAB 2
Lab Task 1 use a simple array to store the marks of 10 students from quiz 1 of data structure
course, the obtained marks are considered out of 15. Write function to compute average marks
for the entire class.
Lab Task 2 Write a program using float ArrayList to store temperature of a week, and write
functions to find week maximum temprature.
Lab Task 3 By using the concept of static linked list, write functions for the following
operations. 1) Insert a value at end of list 2) Remove First value from list 3) Remove last value
from list 4) Display List in Reverse 5) Remove a value from a given index.
LAB 3
Lab Task 1 Find minimum value in a given linked list.
int minimum(node *head)
Lab Task 2 Write a recursive function that finds sum of values of all nodes in a singly linked
list. int sum(Node *head)
Lab Task 3 If two lists are given, write a method which will merge two lists in to a new list. e.g.
list a = {1,3,7,5} list b = {6,10,8,2,4} c = union(a,b) list c = {1,3,7,5, 6,10,8,2,4}

Lab Task 4 If two lists are given, and both contains integer values in ascending order, write a
function which will combine two lists, in a new list, while maintaining the order of values. e.g.
list a = {1,3,5,7} list b = {2,4,6,8,10} list c = {1,2,3,4,5,6,7,8,10} c = merge(a,b)

Lab Task 5 If a lists is given that contains integer values, write a function which will remove all
prime numbers from the list. e.g. list a = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} list b =
{2,4,6,8,10} list c = {1,2,3,4,5,6,7,8,10} c = merge(a,b)

You might also like