23ec3038 Lab7

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

1.

Magic Square Verification: Create a program that checks whether a given square matrix is a magic
square or not. A magic square is a square matrix where the sum of every row, column, and diagonal
is the same.

2. Transposing a Matrix: Write a function to transpose a given 2D square matrix in-place, i.e.,
without using an additional matrix.
3. Array Shuffling: Implement a function to shuffle the elements of an integer array randomly. Ensure
that each permutation of the array is equally likely.

4. Finding Duplicates: Develop a program to find and remove duplicates from an array without using
additional data structures. Preserve the order of the elements
5. Prime Number Generation: Write a program to generate and display the first N prime numbers,
where N is provided by the user

6. Bubble Sort Visualization: Create a program that visualizes the bubble sort algorithm in action.
Display the array at each step of the sorting process.
7. Linear Search Improvement: Enhance the linear search algorithm to perform both forward and
backward searches simultaneously, effectively halving the search time.

8. Array Rotation: Implement a function to rotate an array of integers to the left by a given number
of positions. Preserve the order of elements.

9. Pascal's Triangle: Write a program to generate and display Pascal's triangle up to a given number
of rows. Pascal's triangle is constructed such that each number is the sum of the two numbers
directly above it.

10. Array Partitioning: Design an algorithm to partition an array of integers into two subsets such that
the absolute difference between their sums is minimized. Return the minimum absolute difference.

You might also like