Showing posts from November, 2013

Convert roman numerals to decimal in java

Read a roman number and convert that into decimal. For such a problem we have to find a suitable solution. we need to write a method to read the Roman number and a converter. there is a  common patterns in Roman numbers and find a solution to convert. For example , " III "means 1+1+1=3 , " V " means 5 " IV " means 4 how ? let see , First read string and check from back to front .so now we have first " V " and " I " .now check last character is grater other one then " - " operator else " + "operator   ( if V > I then 5 - 1 = 4 )

Sparse Matrix Operations in Java

In the subfield of numerical analysis, a sparse matrix is a matrix populated primarily with zeros (Stoer & Bulirsch 2002, p. 619) as elements of the table. By contrast, if a larger number of elements differ from zero, then it is common to refer to the matrix as a dense matrix. The fraction of zero elements (non-zero elements) in a matrix is called the sparsity (density).