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
Vinvika [58]
1 year ago
15

9.11: Array Expander

Computers and Technology
1 answer:
vodka [1.7K]1 year ago
3 0

The Array Expander is an illustration of arrays and functions.

  • Arrays are variables that stores multiple values
  • Functions are named statements that are executed when called

<h3>The Array Expander program </h3>

The Array Expander program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

//This declares the Array Expander function

int* ArrayExpander(int *oldArr, int size){

   //This declares the new array

   int *newArr = new int[size * 2];

//This iteration sets values into the new array

   for (int i = 0; i < size * 2; i++) {

       if(i < size){

           *(newArr+i) = *(oldArr+i);

       }

       else{

           *(newArr+i) = 0;

       }

   }

//This returns a pointer to the new array

   return newArr;

}

//The main method begins here

int main(){

//This declares the length of the array, N

   int N;    

//This gets input for N

   cin>>N;

   int initArr[N];

//If N is between 1 and 50

   if(N > 0 && N <=50){

//This iteration gets values for the array

       for(int i = 0; i<N; i++){

           cin>>initArr[i];

       }

//This calls the Array Expander function

   int *ptr = ArrayExpander(initArr, N);

//This iteration prints the elements of the new array

   for (int i = 0; i < N*2; i++) {

       cout << ptr[i] << " ";

   }

   }

  return 0;

}

Read more abou C++ programs at:

brainly.com/question/27246607

You might be interested in
Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently long such tha
kvv77 [185]

Answer and Explanation:

a)

For Go-Back-N:

  Host A sent total number of segments is 9.The initial segment numbers are 1,2,3,4,5 and re-sent the segemnts 2,3,4 and 5 because 2nd segment was lost.

Host B sent the number of ACKs are 8.Host B sent ACKs 1 by four times because 2nd segment was lost and sent 4ACKs with sequence numbers 2,3,4 and 5

selective repeat:

 Host A sent total number of segments is 6.The initial segment numbers are 1,2,3,4,5 and re-sent the segemnts 2 because 2nd segment was lost.

Host B sent the number of ACKs are 5.Host B sent four ACKs with sequence numbers 1,3,4,5 and re-sent ACK2 with sequence number 2 because 2nd segment was lost.

TCP :

Host A sent total number of segments is 6.The initial segment numbers are 1,2,3,4,5 and re-sent the segemnts 2 because 2nd segment was lost.

Host B sent the number of ACKs are 5.Host B sent four ACKs with sequence number 2 and There is one ACK with sequence number 6.TCP always send an ACK with expected sequence number

b) If the timeout values for all three protocol are much longer than 5*RTT,then TCP protocol successfully delivers all five data segments in shortest time interval.

 

4 0
3 years ago
The incompatibilities in speed between the various devices and the CPU make I/O synchronization difficult, especially if there a
Iteru [2.4K]

Answer:

In a buffer

Explanation:

We can define a buffer as a temporary holding area for data between the various devices and the CPU make I/O synchronization especially if there are multiple devices attempting to do I/O at the same time.

Items stored at the buffer helps to reduce the The incompatibilities in speed between the various devices and the CPU.

3 0
3 years ago
Which type of address defines a single network interface in a computer or other device?
White raven [17]
MAC address
......... ..
4 0
2 years ago
What is a characteristic of the network layer in the OSI model allows carrying packets for multiple types of communications amon
Paladinen [302]

Answer:

The correct answer to the following question will be "The capacity to work without reference to the data that would be contained in each bundle".

Explanation:

  • The Layer network governs the activity of the subnet. The main objective of this layer would be to transport data over multiple links from source to destination. When two computers are linked to the same cable, see no need for the network layer.
  • The role of this layer protocols defines the configuration and handling of packets used to transfer information from one to another host.
  • The main purpose of this layer is to allow multiple channels to be intertwined. This is achieved by sending packets to network adapters that depend on algorithms to identify the best directions for the information to move. Such routes are referred to as computer circuits.

Therefore, it would be the right answer.

6 0
3 years ago
In Criminal justice, the type of evidence which contradicts a given theory is known as?​
irina [24]

Answer:

In general, scientific evidence are the results of scientific tests used to prove or disprove a theory or hypothesis. In criminal cases, scientific evidence is used to help jurors understand and determine the facts of a case. Explanation:

3 0
2 years ago
Other questions:
  • Which of the following is not a network connection LAN WAN SAN MAN
    6·1 answer
  • What can be entered in a search box to find data? data size a name relevance purpose
    5·2 answers
  • You are adding new wires in your building for some new offices. The building has a false ceiling that holds the lights and provi
    8·1 answer
  • Describe the functions of ALU, resisters, CU, BIU, Cache and FPU.
    7·1 answer
  • You can combine the algorithms for converting between infix to postfix and for evaluating postfix to evaluate an infix expressio
    13·1 answer
  • Multi-part question:
    13·1 answer
  • What is keyword density?
    15·2 answers
  • What's the commission payout for auto bill pay if sold with a ga?
    6·1 answer
  • write an algorithm to determine a student's final grade and indicate whether it is passing or failing. the final grade is calcul
    6·1 answer
  • Over the last decade, the overall energy consumption of cloud data centers worldwide has remained relatively the same. Why is th
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!