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
Sedbober [7]
3 years ago
5

Define an ADT for a two-dimensional array of integers. Specify precisely the basic operations that can be performed on such arra

ys. Next, imagine an application that stores an array with 1000 rows and 1000 columns, where less than 10,000 of the array values are non-zero. Describe two different implementations for such arrays that would be more space efficient than a standard two-dimensional array implementation requiring one million positions.
Engineering
1 answer:
VashaNatasha [74]3 years ago
6 0

Answer:

Explanation:

ADT for an 2-D array:

struct array{

int arr[10];

}arrmain[10];

An application that stores an array with 1000 rows and 1000 columns, where less than 10,000 of the array values are non-zero. The two different implementations for such arrays that would be more space efficient than a standard two-dimensional array implementation requiring one million positions are :

1) struct array{

int *p;

}arr[1000];

2) struct array{

int *p;

}arr[1000];

You might be interested in
For a project in C++ we are supposed toDesign a class named Month. The class should have the following private members:-name: a
mart [117]

Answer:

include <iostream>

using namespace std;

 

class Month

{

public:

 Month (char firstLetter, char secondLetter, char thirdLetter);

 

 Month (int monthNum);

.

 

 Month();

 void outputMonth_num();

 

 

 void outputMonthLetters();

private:

 int month;

};

 

 

int main ()

{

 //

 // Variable declarations

 //

 int monthNum;

 char firstLetter, secondLetter, thirdLetter;    

 char testAgain;              

 

 do {

 

   cout << endl;

   cout << "Testing the default constructor ..." << endl;

   Month defaultMonth;

   defaultMonth.outputMonth_num();

   defaultMonth.outputMonthLetters();

 

   //

   // Construct a month using the constructor with one integer argument

   //

   cout << endl;

   cout << "Testing the constructor with one integer argument..." << endl;

   cout << "Enter a month number: ";

   cin >> monthNum;

 

   Month testMonth1(monthNum);

   testMonth1.outputMonth_num();

   testMonth1.outputMonthLetters();

 

   //

   // Construct a month using the constructor with three letters as arguments

   //

   cout << endl;

   cout << "Testing the constructor with 3 letters as arguments ..." << endl;

   cout << "Enter the first three letters of a month (lowercase): ";

   cin >> firstLetter >> secondLetter >> thirdLetter;

   cout << endl;

 

   Month testMonth2(firstLetter, secondLetter, thirdLetter);

   testMonth2.outputMonth_num();

   testMonth2.outputMonthLetters();

 

   //

   // See if user wants to try another month

   //

   cout << endl;

   cout << "Do you want to test again? (y or n) ";

   cin >> testAgain;

 }

 while (testAgain == 'y' || testAgain == 'Y');

 

 return 0;

}

 

 

Month::Month(char firstLetter, char secondLetter, char thirdLetter)

{

if ((firstLetter == 'j')&&(secondLetter == 'a')&&(thirdLetter == 'n'))

  outputMonth_num = 1;

if ((firstLetter == 'f')&&(secondLetter == 'e')&&(thirdLetter == 'b'))

  outputMonth_num = 2;

if ((firstLetter == 'm')&&(secondLetter == 'a')&&(thirdLetter == 'r'))

  outputMonth_num = 3;

if ((firstLetter = 'a')&&(secondLetter == 'p')&&(thirdLetter == 'r'))

  outputMonth_num = 4;

if ((firstLetter == 'm')&&(secondLetter == 'a')&&(thirdLetter == 'y'))

  outputMonth_num = 5;

if ((firstLetter == 'j')&&(secondLetter == 'u')&&(thirdLetter == 'n'))

  outputMonth_num = 6;

if ((firstLetter == 'j')&&(secondLetter == 'u')&&(.thirdLetter == 'l'))

  outputMonth_num = 7;

if ((firstLetter == 'a')&&(secondLetter == 'u')&&(thirdLetter == 'g'))

  outputMonth_num = 8;

if ((firstLetter == 's')&&(secondLetter == 'e')&&(thirdLetter == 'p'))

  outputMonth_num = 9;

if ((firstLetter == 'o')&&(secondLetter == 'c')&&(thirdLetter == 't'))

  outputMonth_num = 10;

if ((firstLetter == 'n')&&(secondLetter == 'o')&&(thirdLetter == 'v'))

 outputMonth_num = 11;

if ((firstLetter == 'd')&&(secondLetter == 'e')&&(thirdLetter == 'c'))

 outputMonth_num = 12;

}

 

Month::inputMonthByNumber

{

if (Month_num > 12 && Month_num < 1)

cout << "Invalid number for Month, please choose 1-12)\n";

}

 

void Month::outputMonth_num()

{

 if (month >= 1 && month <= 12)

   cout ><< "Month: " << month << endl;

 else

   cout << "Error - The month is not a valid!" << endl;

}

 

void Month::outputMonthLetters()

{

 switch (month)

   {

   case 1:

     cout << "Jan" << endl;

     break;

   case 2:

     cout << "Feb" << endl;

     break;

   case 3:

     cout << "Mar" << endl;

     break;

   case 4:

     cout << "Apr" << endl;

     break;

   case 5:

     cout << "May" << endl;

     break;

   case 6:

     cout << "Jun" << endl;

     break;

   case 7:

     cout << "Jul" << endl;

     break;

   case 8:

     cout << "Aug" << endl;

     break;

   case 9:  

     cout << "Sep" << endl;

     break;

   case 10:

     cout << "Oct" << endl;

     break;

   case 11:

     cout << "Nov" << endl;

     break;

   case 12:

     cout << "Dec" << endl;

     break;

   default:

     cout << "Error - the month is not a valid!" << endl;

   }

}

7 0
2 years ago
Movimiento
goblinko [34]

wth u should clear ur question

5 0
3 years ago
What are the five types of civil engineering
KatRina [158]

Answer: The five types of the civil engineering projects is construction and management, geotechnical, structural, transport, water, and architecture

Explanation: Hope this helps

5 0
3 years ago
Read 2 more answers
You will write a program estimate that uses a training data set to learn weights for a set of house attributes, and then applies
gizmo_the_mogwai [7]

Answer:

I can share a link to answer since the code is to long to be contained here. the code is on github

https://github.com/arafatm/edu_coursera_machine_learning_1_foundations/blob/master/code/02.01.predicting.house.prices.ipynb

5 0
2 years ago
The specifications of an electronic device are 24 /- 0.4 Amps. When the device exceeds specifications the average quality cost i
Misha Larkins [42]

Answer:

The average loss for this device is $10.90

Explanation:

Given data

Specification = 24 +/- 0.4 Amps

average quality cost = $32.00

average value y = 23.9

standard deviation s = 0.211 Amps

32 = k(24.4 - 24)²

32 = k(0.4)² = k(0.16)

k = 32/0.16 = 200

To evaluate average loss, use

L = k{s² + (y - T)²}

T = 24A

L = 200{0.211² + (23.9 - 24)²}

L = $10.90

The average loss for this device is $10.90

4 0
2 years ago
Other questions:
  • A teacher tells her​ students, "When you do your math homework​ assignments, you must use white lined paper.​ Please, no​ tear-o
    15·1 answer
  • One of the basic requirements of a servomotor is that it must produce high torque at all: a)Frequencies b)-Voltages c)-Loads d)-
    14·1 answer
  • A steel wire of diameter 2.000 mm and length 1.000 m is attached between two immovable supports.When the temperature is 60.00 Ce
    9·1 answer
  • Acredit report summarizes a person's Acredit score is measure of a person's as a borrower a factor that contributes to a person'
    15·1 answer
  • Which should i get they are both for sale
    10·2 answers
  • FREE 50 points &amp; maybe one brain liest
    5·2 answers
  • The electrical panel schedules are located on EWR Plan number ___.
    13·1 answer
  • How would you use an inclined plane to increase speed?​
    9·1 answer
  • Which principle of the software engineering code of ethics has gilbert violated?.
    10·1 answer
  • which of the following is not a general education elective area? group of answer choices humanities/fine arts social/behavioral
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!