Both horizontal and vertical mirror1/9/2024 ![]() ![]() Algorithm (Steps)įollowing are the Algorithm/steps to be followed to perform the desired task –.Ĭreate a function checkHorizontalVertical() to check whether the input matrix is horizontal or vertically symmetric by passing the input matrix, no of rows and columns as arguments. The elements in the first column align with the elements in the same positions in the third column. Vertical symmetry: The first column, "1 0 1," is a mirrored version of the third column, "1 0 1," when the matrix is flipped vertically. Each element in the first row corresponds to the element in the same position in the third row. Horizontal symmetry: The first row, "1 0 1," is an exact mirror reflection of the third row, "1 0 1," when the matrix is flipped horizontally. ![]() If the first column matches the last column, the second column matches the second last column, and so on, the matrix is said to be vertically symmetric. If the first row matches the last row, the second row matches the second last row, and so on, the matrix is said to be horizontally symmetric. ![]() We will now check whether the input matrix is horizontal or vertically symmetric or both using the below method. It is widely employed to represent relationships, connectivity, and patterns across various disciplinesĪssume we have taken a 2D binary input matrix containing N rows and M columns. A binary matrix is a rectangular grid in which each element is either 0 or 1, indicating true or false states. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |