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
A plan to budget time for studying and activities is referred to as
krok68 [10]

Answer:

a study schedule.

Explanation:

A plan to budget time for studying and activities is referred to as a study schedule. A study schedule is mostly designed by a student and it comprises of their learning goals and objectives, as well as allocated time to start and  complete.

The main purpose of a study schedule is to avail students the opportunity to maximize their time and improve their ability to study by themselves through an organized schedule for specific subjects, courses or class.

3 0
2 years ago
1 pts Question 5 Which of the following calculations would evaluate to 12? (36) + 2/2, 3* ((6+2)/2), 3* 6+2/2, (306+ 2)/2​
julia-pushkina [17]

Answer:

Could you seperate them if they are different answers? I'm lost, sorry!

Explanation:

5 0
3 years ago
You receive an offer for a credit card that can be use to accrue points that
Jlenok [28]

Answer: (C) A special service for current customers

Explanation:

  The CRM is the customer relationship management that typically use by the banks for providing special type of services to the current customer. This is the way to attract various types of users or customers by providing some special type of offers.

According to the question, bank provide the credit card offers to the customer on the airline tickets so, it is beneficial for both the customer and for the bank as well.

3 0
3 years ago
What are the pros and cons of using the internet in a medical office setting?
konstantin123 [22]
Pros:
-They can share information between different medical offices quicker than they could before hand.
-It is cheaper to send information via the internet than it is to hand it by hand

Cons:
-Hackers can get access to the medical patient's information.
-The upkeep costsof the internet connection may lower their income.
7 0
2 years ago
Which AWS service is a managed service that makes it easy to set up, operate, and scale a relational database in the cloud?​
vaieri [72.5K]

Answer:

I use Google cloud free tier for my Minecraft server

4 0
3 years ago
Other questions:
  • If you need to use a custom theme frequently, you can save a presentation file as a(n) ____ theme file.
    12·2 answers
  • What operating system type uses icons to represent programs
    9·2 answers
  • Which of the following best describes the purpose of a design specification?
    14·2 answers
  • What is the easiest way to create a resume in Word with predefined content that can be replaced with your information?
    13·2 answers
  • Which term refers to the blank areas surrounding a document page? *
    15·1 answer
  • When parallel parking, you should select a space that is __________ as long as your car.
    11·1 answer
  • Misspelet errors are displays with a ...<br>.. below them<br>​
    10·1 answer
  • Which of the following would be least effective?
    10·1 answer
  • WHO HAS TWITCH<br> PLS FOLLOW ME MY TWITCH IS giaplayzgamez I'm uploading Videos Soon.
    11·2 answers
  • Why does the media play such an important role in our personal freedom? Select 3 options.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!