Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 0 Write a C code to create two vectors A and B, with n elements and calculate following operations and store the results into

image text in transcribed

Problem 0 Write a C code to create two vectors A and B, with n elements and calculate following operations and store the results into the vector C I. Addition C (co,C.cn-1)-A(ao.aj..an- B(bob bn-1) where (co,C1.Cn-1)-(ao + bo,a1 +ban-1 + bn-1) II. Subtraction C (Co, C1.cn-1)-A(ao,a, ..an-1) B(bob bn-1) where (co,C1.n-1 (a0- bo, a1 -ban-1-bn-1) your C code should have following features: a. You need to read the dimension of the vectors (n) from command line. b. Use the random number generator in C ( rand() % 1000000 ) to generate random integer elements between 0 and 1,000,000 for the vectors A and B. Your C codeurs r r an d. Each operation needs to get implemented using a function and use pointer to pass your vectors to these functions. e. Measure the execution time for each operation separately for different values of n and complete the following table and draw a bar-chart for it using Microsoft Excel. Execution Time n = 1

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

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions