You are on page 1of 2

School of Computer Science Engineering and Technology

Course- MCA/MTECH Type- Core


Course Code- CSET509/CMCA510 Course Name- Data Structures using Python

Year- 2023 Semester- Odd


Date- 01/09/2023 Batch- 2023-2026

CO-Mapping
CO1 CO2 CO3 CO4
Q1 √ √
Q2 √ √
Q3 √ √

Objectives
1. Students will be able to learn linear search and binary search
2. Students will be able to learn different sorting techniques.
3. Students will learn binary search.

Tutorial Assignment (Week 2, Assignment 1)


1. Which search is faster linear or binary, explain with reasons.
2. Explain which of the sorting algorithm is given below and what is use of
is_sorted variable:

public static void sort(int[] a) {


for (int i = 1; i < a.length; i++) {
boolean is_sorted = true;

for (int j = 0; j < a.length - i; j++) { // skip the already sorted largest elements, compare to
a.length - 1
if (a[j] > a[j+1]) {
int temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
School of Computer Science Engineering and Technology
is_sorted = false;
}
}

if(is_sorted) return;
}
}
3. Write an iterative version of binary search with comments explaining the steps.

You might also like