Assignment on ICE2232 Data Structure and Algorithm Lab-2024
Lab Assignment-1: Exploring Array Data Structures and Algorithms
(Task1, Task2, Task3, and Task4)
Objective:
The objective of this lab assignment is to provide students with a comprehensive
understanding of arrays, their operations, and algorithms that involve arrays.
Task 1: Basic Array Operations
1. Create a program in your preferred programming language (e.g.,
Python, C++, Java) to perform the following operations on an array:
(i) Declare an integer array with a size of at least 10.
(ii) Initialize the array with random values (you can use a
random number generator).
(iii) Print the elements of the array.
2. Extend your program (create additional functions) to:
(i) Calculate and print the sum of all elements in the array.
(ii) Find and print the maximum and minimum values in the
array.
(iii) Calculate and print the average value of the elements.
Task 2: Array Sorting Algorithms
1. Implement the following sorting algorithms for an integer array:
(i) Selection Sort
(ii) Bubble Sort
(iii) Insertion Sort
2. Create a program that allows the user to choose one of these sorting
algorithms, enter an array, and then sorts and prints the sorted array
using the selected algorithm.
Task 3: Searching in Sorted Arrays
(i) Implement the Binary Search algorithm for an integer array.
(ii) Create a program that:
(a) Declares an array of integers and sorts it using one of the
sorting algorithms from Task 2 (1).
(b) Allows the user to enter a value to search for in the sorted
array.
(c) Uses Binary Search to find and print whether the value is found
or not.
Assignment on ICE2232 Data Structure and Algorithm Lab-2024
Task 4: Merge Two Sorted Arrays
1. Create a program in your preferred programming language (e.g.,
Python, C++, Java) to merge two sorted integer arrays into a single
sorted array.
2. Implement the merging algorithm efficiently with a time complexity
of O(n), where n is the total number of elements in both arrays.
3. Print the merged sorted array.
Lab Assignment-2: Searching, Sorting and Merging Multi-dimensional
Arrays (Task 5, Task6, and Task 7)
Objective:
The objective of this lab assignment is to help students understand multi-
dimensional arrays, practice searching, sorting and merging algorithms within
these arrays, and apply these skills to real-world scenarios.
Task 5: Searching in a 2D Array
1. Create a program in your preferred programming language (e.g., Python,
C++, Java) that allows the user to:
(a) Declare a 2D integer array of a size of your choice.
(b) Populate the array with random values.
(c) Enter a value to search for within the 2D array.
(d) Implement a search algorithm (e.g., linear search or binary search) to
find the value in the 2D array and return its position (row and
column).
(e) Print the position where the value was found or a message indicating
that it wasn't found.
Task 6: Sorting Rows in a 2D Array
1. Extend your program to sort the rows of the 2D array in ascending order
based on a chosen column (the user should specify the column).
(a) Implement a sorting algorithm (e.g., quicksort or mergesort) to
perform the sorting operation efficiently.
(b) Print the sorted 2D array.
Assignment on ICE2232 Data Structure and Algorithm Lab-2024
Task 7: Merge Two 2D Arrays
1. Create a program in your preferred programming language (e.g., Python,
C++, Java) to merge two 2D integer arrays into a single 2D array.
2. Implement the merging algorithm efficiently with a time complexity of
O(n), where n is the total number of elements in both arrays.
3. Print the merged 2D array.
Students are recommended to complete this assignments on/before
6th August 2025.