nvayin agha

Greenhorn

Posts: 16

nvayin agha

Greenhorn

Posts: 16

posted 1 year ago

In "this" case meaning which of the two cases you have there?

You are already calculating distance correctly in your calculateDistance method; the other method I don't know whether it's correct because I don't know what it's supposed to do. It has no comments explaining its purpose and a name which doesn't mean anything to me.

You are already calculating distance correctly in your calculateDistance method; the other method I don't know whether it's correct because I don't know what it's supposed to do. It has no comments explaining its purpose and a name which doesn't mean anything to me.

nvayin agha

Greenhorn

Posts: 16

Piet Souris

Master Rancher

Posts: 2044

75

posted 1 year ago

hi nvayin,

what you do in your method 'Euclideanorm' is to calculate the sum of all the elements, and returning the square root of that sum.

Now, I don't know what the mathematical meaning of this is.

But given a 2D array, you can calculate the distance between any two columns or any two rows, like you do in your 'calculateDistance' method.

what you do in your method 'Euclideanorm' is to calculate the sum of all the elements, and returning the square root of that sum.

Now, I don't know what the mathematical meaning of this is.

But given a 2D array, you can calculate the distance between any two columns or any two rows, like you do in your 'calculateDistance' method.