View Single Post
Old Apr 17th, 2005, 4:24 PM   #1
zxasqwedc
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 zxasqwedc is an unknown quantity at this point
Exclamation java homework.. please HELP!!

i take java lessons at univercity and i have to complete this homework before 21th April.. I do need your help very badly.. please help me!

-------------------------------------------------------------------
my homework questions>>>>>>>>

1-A sparse vector is a vector where most of the entries have 0 value. One
way to store sparse vectors would be to use regular double arrays, but
this would be a waste of storage since only a tiny ratio of the elements
of the array will have non-zero values. Come up with an idea that
reduces the space requirements of the vector and implement the following
items for a new class called SparseVector

* A constructor that creates a vector of n dimensions which
initially will have 0 values for all the dimensions.
* A put() method that will put a new non-zero value to a location in
the vector
* A get() method that will get the value stored in a specific location
* An add() method that will add another SparseVector and return the
result. You can assume that the vectors have same size.
* A multiply method that will multiply the vector with a constant


2-Write a new class SparseMatrix similar to SparseVector. Your class
should have similar versions of all the required methods and constructors.
------------------------------------------------------------------------

thnx very very much!!!
zxasqwedc is offline   Reply With Quote