Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following code to read the two _ dimensional table from file ( PeakTable _ 1 . txtand then from PeakTable _ 2 .

Use the following code to read the two_dimensional table from file(PeakTable_1.txtand then from PeakTable_2.txt and display it as a matrix to the screen. PeakTable_2.txt has rows =97 and columns =29. PeakTable1.txt has rows =4 and columns =5.
You need to implement this question using C++ and provide a screenshot of the output.
import time
def readingMatrix() :
f = open('peakTable_2.txt','r')
list1=[]
list1=[line.split() for line in f]
return list1
def displayMatrix(theList) :
for row in range(0, len(theList)) :
for col in range(0, len(theList[0])) :
print("{0:<3}".format(theList[row][col]), end ="")
print("")
print("*** reading matrix ***")
list1= readingMatrix()
print(" # rows =", len(list1)," #cols=", len(list1[0]))
displayMatrix(list1)
Display_AllPeaks_Positions
Then you must include this:
Use the below to display the time your algorithm takes in milliseconds.
time1= time.time()
time2= time.time()
print('elapsed time:', time2- time1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started