ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 10 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 11 May 2017 My Price 9.00

Write Java (Sparse Vector)

Write Java (Sparse Vector) for the following two ADD and SUBTRACT methods using DOUBLYLINKEDLIST

A)

Vector addition produces the sum of two vectors, the sum vector. If an element with a particular index exists in both vectors then add the values of the elements together to form the element with that index in the sum vector. If the sum of the two values is zero then that element does not appear in the sum vector. If an element with a particular index exists in only one vector then copy that element to the sum vector.

An example:
A is ([3, 1.0], [2500, 6.3], [5000, 10.0], [60000, 5.7]) B is ([1, 7.5], [3, 5.7], [2500, -6.3])
A + B is ([1, 7.5], [3, 6.7], [5000, 10.0], [60000, 5.7])

a.The add method: public SparseVector add(SparseVector sv), which performs the

addition of two sparse vectors. For example, if A and B are sparse vectors then A.add(B) returns a

SparseVector which is A+B.

B)

Vector subtraction produces the difference of two vectors, the difference vector. If an element with a particular index exists in both vectors then subtract the value of the element in the second vector from the value of the element in the first vector to form the element with that index in the difference vector. If the difference of the two values is zero then that element does not appear in the difference vector. If an element with a particular index exists in the first vector but not the second vector then copy that element to the difference vector. If an element with a particular index exists in the second vector but not the first vector then copy that element to the difference vector and negate its value.

An example:
A is ([3, 1.0], [2500, 6.3], [5000, 10.0], [60000, 5.7])
B is ([1, 7.5], [3, 5.7], [2500, -6.3])
A - B is ([1, -7.5], [3, -5.7], [2500, 12.6], [5000, 10.0], [60000, 5.7])

b. The subtract method: public SparseVector subtract(SparseVector sv), which

performs the subtraction of two sparse vectors. For example, if A and B are sparse vectors then

A.subtract(B) returns a SparseVector which is A-B.

 

Answers

(11)
Status NEW Posted 11 May 2017 09:05 AM My Price 9.00

-----------

Attachments

file 1494493876-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)
Relevent Questions