0% found this document useful (0 votes)
9 views1 page

Programs

The document outlines functionalities for managing theater seating arrangements, including booking and canceling seats. It also includes a validation method for checking a 9x9 Sudoku grid for unique digits and provides a way to count the frequency of elements in an array. Additionally, it describes how to print the elements of a 2D matrix in spiral order.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Programs

The document outlines functionalities for managing theater seating arrangements, including booking and canceling seats. It also includes a validation method for checking a 9x9 Sudoku grid for unique digits and provides a way to count the frequency of elements in an array. Additionally, it describes how to print the elements of a 2D matrix in spiral order.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//Seating Arrangement

Each row in a theater can have a different number of seats.

Store the seat status (true = booked, false = free).

Book or cancel seats dynamically.

//Validate if all rows of a 9x9 sudoku grid contain all digits 1-9 with no
repetition.
int[][] sudoku = {
{5, 3, 4, 6, 7, 8, 9, 1, 2},
{6, 7, 2, 1, 9, 5, 3, 4, 8},
{1, 9, 8, 3, 4, 2, 5, 6, 7},
{8, 5, 9, 7, 6, 1, 4, 2, 3},
{4, 2, 6, 8, 5, 3, 7, 9, 1},
{7, 1, 3, 9, 2, 4, 8, 5, 6},
{9, 6, 1, 5, 3, 7, 2, 8, 4},
{2, 8, 7, 4, 1, 9, 6, 3, 5},
{3, 4, 5, 2, 8, 6, 1, 7, 9}
};

//Count and display the frequency of each unique element in an array.

//Print the elements of a 2D matrix in spiral order:

Left → Right

Top → Bottom

Right → Left

Bottom → Top (and repeat)

int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
Spiral Order:
1 2 3 6 9 8 7 4 5

You might also like