1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Whitepunk [10]
2 years ago
9

sparse(compact) Description: A sparse matrix is a 2D matrix that has many zeros. Assume that for storage efficiency someone has

converted a sparse matrix into a compact 2D matrix with dimensions Nx3 where N is the number of non-zero items in the original sparse matrix. In each row of compact, the first column holds the value of a non-zero item of the sparse matrix, the second column holds the row that this item resides in the sparse matrix, and the third column holds the column that this item resides in the sparse matrix. Write a function that given a compact matrix it returns the original sparse matrix. Assume the last row and the last column of the sparse matrix contain at least one non-zero item. Parameters: compact (list of list of int). Return value: a sparse list of list of int Example: sparse([[3,1,2],[4,5,3]]) → [ [0,0,0,0], [0,0,3,0], [0,0,0,0], [0,0,0,0], [0,0,0,0],

Computers and Technology
1 answer:
barxatty [35]2 years ago
8 0

Answer:

Function sparse code is

def sparse(a):

rl = []

cl = []

for i in range(0,len(a)):

rl.append(a[i][1])

cl.append(a[i][2])

r = max(rl)

c = max(cl)

s = []

k = 0

for i in range(0,r+1):

s.append([])

for j in range(0,c+1):

if (i==a[k][1]) & (j == a[k][2]):

s[i].append(a[k][0])

k = k+1

else:

s[i].append(0)

return s

def main():

k = sparse([[3,1,2],[4,5,3]])

print(k)

if __name__ == '__main__':

main()

Explanation:

Please see attachment for output

You might be interested in
An audit trail is a record of how a transaction was handled from input through processing and output
Nostrana [21]

The answer is : True.  An audit trail is a record of how a transaction was handled from input through processing and output.  An audit trail is the evidence, such as purchase orders and invoices, that a financial transaction actually occurred.

6 0
3 years ago
explain the joke, “There are 10 types of people in the world: those who understand binary and those who don’t.”
tino4ka555 [31]

Answer:

Binary is made up of only 2 digits: a one and a zero. 1011 is eleven in our counting system.

So 10 in binary = 2 in our counting system.

Read the joke as follows. There are 2 types of people in the world: those who  understand binary and those who do not.

I guess it's not really that funny, but computer programmers like it.

6 0
10 months ago
ANSWER ASAP!!! 12 POINTS!!!!! RIGHT ANSWERS ONLY
suter [353]

Answer:

B.

Explanation:

8 0
2 years ago
Read 2 more answers
Proxy is a network computer that can serve as an intermediary for connecting with other computers.
Keith_Richards [23]

Answer:Protects the local network from outside access

Explanation:Proxy is a type of serves as the mediator in computer network for connecting the network with the user system. These servers are responsible for maintaining the security against any unauthorized access in the system or internet,privacy and other functions.. It helps in protecting the whole network connection by taking the control at the servers .

8 0
3 years ago
what feature allows you to create a form letter or certificate and personalized it for different recipients by usin the info in
agasfer [191]

Answer:

mail merge is the answer to this one i believe

6 0
3 years ago
Other questions:
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
    9·1 answer
  • What is a win-win situation?
    5·1 answer
  • Why can’t I “change the country” on settings??<br> (In this app)
    13·1 answer
  • If I'm screen sharing and I plug in a HDMI, will it screen share what the HDMI is plugged into, and can you talk at the same tim
    11·1 answer
  • Suppose testcircle1 and circle1 in listing 9.1 are in two separate files named testcircle1.java and circle1.java, respectively.
    14·1 answer
  • How are satellite radio, Internet radio, and podcasting different?
    11·1 answer
  • Question of Computer science​
    7·1 answer
  • if a hacker wants to exploit the TCP three-way handshake, what is the most effective way to go about it?
    15·1 answer
  • Please help!!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!