0% found this document useful (0 votes)
12 views

Al Question

This document contains a midterm exam for a computer science algorithms course. It includes 3 questions worth 10 points each, covering topics like: 1) The differences between algorithms and programs, different algorithm analysis schemes including time and space complexity analyses of a sample program. 2) Analyzing best, worst, and average cases for linear search of an array and binary search of a tree. Defining disjoint sets and performing set operations. 3) Detecting cycles in graphs, explaining collapsing finds, writing binary search and quicksort algorithms with examples. 4) Defining heaps, performing insertion, writing a merge sort algorithm with a sample trace tree.

Uploaded by

Golam Daiyan
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Al Question

This document contains a midterm exam for a computer science algorithms course. It includes 3 questions worth 10 points each, covering topics like: 1) The differences between algorithms and programs, different algorithm analysis schemes including time and space complexity analyses of a sample program. 2) Analyzing best, worst, and average cases for linear search of an array and binary search of a tree. Defining disjoint sets and performing set operations. 3) Detecting cycles in graphs, explaining collapsing finds, writing binary search and quicksort algorithms with examples. 4) Defining heaps, performing insertion, writing a merge sort algorithm with a sample trace tree.

Uploaded by

Golam Daiyan
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

EASTDELTAUNIVERSITY (EDU)

Mid Term Examination–Spring 2023


School of Science, Engineering and Technology
Department of Computer Science and Engineering
Course Title: Algorithms
Course Code: CSE 221

Time: 1.20 Hours Full Marks: 30

Answer any three questions from the following: 3X10 =30


1. a) State the difference between algorithm and program? 1
b) State the different schemes for analyzing an algorithm? Which type do you follow to 4
analysis? Why?
c) Perform the time and space complexities of the given program: 4
Algorithm multiply(A,B,n)
{
for (i=0; i<n; i++)
A[i]=0
{
for( j=0; j<n; J++)
B[j}=0
{
For (k=0; k<n; k++)
{
C[k]=A[i]+B[j]
}}}

d) List the different types of time function and compare them? 1

2. a) Analysis the best, worst and average case for searching any element from the given array 4
using linear search?

b) Why average case analysis is impossible to obtain at complex algorithms? Perform the 4
best- and worst-case analysis for finding an element from a tree using binary search?

c) Define disjoint set? Perform find and union operation from the given disjoint sets 2
S1={1,2,3,4} and S2={5,6,7,8}?

Page 1 of 2
3. 10

a) Detect the cycle from the given graph?


b) Explain collapsing find from the graph?
4. a) Write an algorithm for binary search? Perform binary search to find the key= 3 from an 5
array?

b) Perform the quick sort on the given list? 5

5. a) Define Heap? Perform insertion of 60 in the given max heap? 5

b) Write the algorithm for merge sort? Draw a tracing tree for merge sort from the given array? 5
9 3 7 5 6 4 8 2

Page 2 of 2

You might also like