- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2616 Articles for Java
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
232 Views
In this article, we will understand how to determine if a given Matrix is a sparse matrix. A matrix is said to be sparse matrix if most of the elements of that matrix are 0. It implies that it contains very less non-zero elements.Below is a demonstration of the same −Suppose our input is −Input matrix: 4 0 6 0 0 9 6 0 0The desired output would be −Yes, the matrix is a sparse matrixAlgorithmStep 1 - START Step 2 - Declare an integer matrix namely input_matrix Step 3 - Define the values. Step 4 - Iterate over each ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
664 Views
In this article, we will understand how to display an upper triangular matrix. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix. An upper triangular matrix is a triangular matrix with all elements below the main diagonal are 0.Below is a demonstration of the same −Suppose our input is −The matrix is defined as: 2 1 4 1 2 3 3 6 2The desired output would be −The upper triangular matrix is: 2 1 4 0 2 3 0 0 2AlgorithmStep 1 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
In this article, we will understand how to recursively linearly search an element in an array. Linear search is a very simple search algorithm wherein a sequential search is done for all items one by one.Below is a demonstration of the same −Suppose our input is −Input array: 14 20 35 47 50 65 72 81 90 99 Key element: 72The desired output would be −The element 72 is present at position: 6AlgorithmStep 1 - START Step 2 - Declare a string array namely input_array, two integer namely key_element and index Step 3 - Define the values. Step 4 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
287 Views
In this article, we will understand how to find the trace and normal of a given matrix. The normal of a matrix is the square root of the sum of squares of all the elements of a matrix. The trace of a matrix is the sum of all the elements present in the principal diagonal (upper left to lower right).Below is a demonstration of the same −Suppose our input is −The matrix is defined as: 2 3 4 5 2 3 4 6 9The desired output would be −Trace value: 13.0 Normal value: 14.142135623730951AlgorithmStep 1 - START Step 2 - ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
733 Views
In this article, we will understand how to multiply to matrix using multi-dimensional arrays. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix.Individual entries in the matrix are called element and can be represented by a[i][j] which suggests that the element a is present in the ith row and jth column.Below is a demonstration of the same −Suppose our input is −First matrix: 2 3 4 5 2 3 4 6 9 Second matrix: 1 5 3 5 6 3 8 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
791 Views
In this article, we will understand how to add two matrix using multi-dimensional arrays. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix. Individual entries in the matrix are called element and can be represented by a[i][j] which suggests that the element a is present in the ith row and jth column.Below is a demonstration of the same −Suppose our input is −First matrix: 2 3 4 5 2 3 4 6 9 Second matrix: 1 5 3 5 6 3 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
143 Views
In this article, we will understand how to interchange the diagonals. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix.Individual entries in the matrix are called element and can be represented by a[i][j] which suggests that the element a is present in the ith row and jth column.Below is a demonstration of the same −Suppose our input is −The matrix is defined as: 4 5 6 1 2 3 7 8 9The desired output would be −The matrix after interchanging the elements: ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
472 Views
In this article, we will understand how to interchange elements of first and last in a matrix across columns. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix.Individual entries in the matrix are called element and can be represented by a[i][j] which suggests that the element a is present in the ith row and jth column.Below is a demonstration of the same −Suppose our input is −The matrix is defined as: 4 5 6 7 1 7 3 4 11 12 13 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
134 Views
In this article, we will understand how to interchange elements of first and last in a matrix across rows. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix.Individual entries in the matrix are called element and can be represented by a[i][j] which suggests that the element a is present in the ith row and jth column.Below is a demonstration of the same −Suppose our input is −The matrix is defined as: 4 5 6 7 1 7 3 4 11 12 13 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
8K+ Views
In this article, we will understand how to compute the sum of diagonals of a matrix. The matrix has a row and column arrangement of its elements. The principal diagonal is a diagonal in a square matrix that goes from the upper left corner to the lower right corner.The secondary diagonal is a diagonal of a square matrix that goes from the lower left corner to the upper right corner.Below is a demonstration of the same −Suppose our input is −The input matrix: 4 5 6 7 1 7 3 4 11 12 13 14 23 24 25 50The desired ... Read More