# Ragged matrix and histogram image problem

ashwin vis

Greenhorn

Posts: 17

posted 5 years ago

Hi i am a newbie learning java.. Well i am currently practicing from the book " A Concise and Practical introduction to programming algorithms in java".. So far now i have covered the basics upto arrays.. I have not yet reached object, strings classes and so on.. the problem i am stuck with is from the chapter on arrays on these 2 problems

A d-dimensional symmetric matrix M is such that Mi,j = Mj,i for all

1 ≤ i, j ≤ d. That is, matrix M equals its transpose matrix: MT = M.

Consider storing only the elements Mi,j with d ≥ i ≥ j ≥ 1 into a ragged

array: double [] [] symMatrix=new double [d][];. Write the array

allocation instructions that create a 1D array of length i for each row of

the symMatrix. Provides a static function that allows one to multiply two

such symmetric matrices stored in “triangular” bi-dimensional ragged

arrays.

Consider that an image with grey level ranging in [0, 255] has been

created and stored in the regular bi-dimensional data-structure byte

[] [] img;. How do we retrieve the image dimensions (width and

height) from this array? Give a procedure that calculates the histogram

distribution of the image. (Hint: Do not forget to perform the histogram

normalization so that the cumulative distribution of grey colors sums up

to 1.)

I dont want any code for these as i want to try and code it myself.. I just dont understand the problems.. Can anyone explain it to me as to what the problems are all about???

About the histogram do i need to display the width as 0 and height as 255 using a function prototype say like DisplayDimensions(byte img[][])???.. I dont think the problem is that simple

I really dont get how do i normalize the histogram and with what data?? And what is histogram distribution??..

A d-dimensional symmetric matrix M is such that Mi,j = Mj,i for all

1 ≤ i, j ≤ d. That is, matrix M equals its transpose matrix: MT = M.

Consider storing only the elements Mi,j with d ≥ i ≥ j ≥ 1 into a ragged

array: double [] [] symMatrix=new double [d][];. Write the array

allocation instructions that create a 1D array of length i for each row of

the symMatrix. Provides a static function that allows one to multiply two

such symmetric matrices stored in “triangular” bi-dimensional ragged

arrays.

Consider that an image with grey level ranging in [0, 255] has been

created and stored in the regular bi-dimensional data-structure byte

[] [] img;. How do we retrieve the image dimensions (width and

height) from this array? Give a procedure that calculates the histogram

distribution of the image. (Hint: Do not forget to perform the histogram

normalization so that the cumulative distribution of grey colors sums up

to 1.)

I dont want any code for these as i want to try and code it myself.. I just dont understand the problems.. Can anyone explain it to me as to what the problems are all about???

About the histogram do i need to display the width as 0 and height as 255 using a function prototype say like DisplayDimensions(byte img[][])???.. I dont think the problem is that simple

I really dont get how do i normalize the histogram and with what data?? And what is histogram distribution??..

Campbell Ritchie

Sheriff

Posts: 48910

58

ashwin vis

Greenhorn

Posts: 17

posted 5 years ago

Yup i am familiar with that.. I know the basics of java and i am just trying to improve my problem solving capacity.. I am using the book to help me think in a way to solve problems!!!.. I just want to be able to solve problems.. So can you please help me with what the problem states???

ashwin vis

Greenhorn

Posts: 17

posted 5 years ago

In the ragged matrix problem.. Do i need to create two matrices say a[5][] and b[5][] and write a function to multiply these two matrices??? get the reason why they given the conditions of matrix transpose??

In the histogram problem i do not know with what data do i calculate the histogram distribution and what is meant by normalization?? And how do i get the values of gray color?? I don't think i can do that with the given 9 and 255

In the histogram problem i do not know with what data do i calculate the histogram distribution and what is meant by normalization?? And how do i get the values of gray color?? I don't think i can do that with the given 9 and 255

Campbell Ritchie

Sheriff

Posts: 48910

58

posted 5 years ago

You have two questions; you would have done better to start two threads.

Until you understand what matrix transformation means, you will not understand our replies.

Until you understand what matrix transformation means, you will not understand our replies.

ashwin vis

Greenhorn

Posts: 17

posted 5 years ago

It's critically important to understand the algorithm before trying to implement it, otherwise you have no mental picture of what you're trying to do.

If this is the kind of problems you're interested in trying to solve, no worries, but if you're interested in more typical problems I don't think an algorithm book is a great place for this.

If this is the kind of problems you're interested in trying to solve, no worries, but if you're interested in more typical problems I don't think an algorithm book is a great place for this.

ashwin vis

Greenhorn

Posts: 17

ashwin vis

Greenhorn

Posts: 17

posted 5 years ago

hey i know linear algebra, calculus even matrix transformations like scaling rotation and all stuffs... All i asked was what the problem states you need not explain to me what i should do in the problem.. Just tell me what the problem says?? I think i am asking for too much. Thanks anyways for all your help..