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
kirill [66]
4 years ago
13

Assume that a two-dimensional rectangular array of integers called matrix has been declared with six rows and eight columns. Wri

te a for loop to exchange the contents of the second column with the fifth column.

Computers and Technology
1 answer:
IgorLugansk [536]4 years ago
4 0

Answer:

following are the program in C++ which is given below

Explanation:

following are the program in C++

#include <bits/stdc++.h>

using namespace std;

int main()  

{

int matrix[6][8]={{1,2,3,4,5,6,7,8},{9,10,11,12,13,14,15,16},{3,3,3,3,3,3,3,3},{4,4,4,4,4,4,4,4},{5,5,5,5,5,5,5,5},{6,6,6,6,6,6,6,6}};

cout<<"Matrix befor swapping:"<<endl;

for(int i=0;i<6;i++)

{

for(int j=0;j<8;j++)

{

cout<<matrix[i][j]<<" ";

}

cout<<endl;

}

for(int i=0;i<6;i++) //iterating over the loop

{

int temp=matrix[i][1];

matrix[i][1]=matrix[i][7];

matrix[i][7]=temp;

}

cout<<"Matrix After swapping:"<<endl;

for(int i=0;i<6;i++) //iterating over the loop

{

for(int j=0;j<8;j++)

{

cout<<matrix[i][j]<<" ";

}

cout<<endl;

Output

attachment are added for the above output.

following are the description of the program

1) read the matrix [i][j] by the user

2) in the loop we exchange the content of 2nd column with 5th column

You might be interested in
Which lossless image type is best suited for webpages but it’s not suitable to print
nexus9112 [7]

Answer:

I believe the answer you're looking for is "PNG"

Explanation:

6 0
3 years ago
Which of the following networks had these two goals: a) allowing scientists to work together on scientific projects; and, b) fun
mrs_skeptik [129]

Answer:

ARPANET

Explanation:

It was the ARPANET sponsored by the US Department of Defense to enable scientists collaborate on research.

5 0
3 years ago
Read 2 more answers
Show the array that results from the following sequence of key insertions using a hashing system under the given conditions: 5,
sergejj [24]

Answer:

a) Linear probing is one of the hashing technique in which we insert values into the hash table indexes based on hash value.

Hash value of key can be calculated as :

H(key) = key % size ;

Here H(key) is the index where the value of key is stored in hash table.

----------

Given,

Keys to be inserted are : 5 , 205, 406,5205, 8205 ,307

and size of the array : 100.

First key to be inserted is : 5

So, H(5) = 5%100 = 5,

So, key 5 is inserted at 5th index of hash table.

-----

Next key to inserted is : 205

So, H(205) = 205%100 = 5 (here collision happens)

Recompute hash value as follows:

H(key) =(key+i) % size here i= 1,2,3...

So, H(205) =( 205+1)%100 = 206%100 = 6

So, key 205 is inserted in the 6th index of the hash table.

----------

Next Key to be inserted : 406

H(406) = 406%100 = 6(collision occurs)

H(406) =(406+1) %100 = 407%100 = 7

So, the value 406 is inserted in 7the index of the hash table.

-----------------

Next key : 5205

H(5205) = 5205%100 = 5(collision)

So, H(5205) = (5205+1)%100 = 6( again collision)

So, H(5205) = 5205+2)%100 = 7(again collision)

So, H(5205) = (5205+3)%100 = 8 ( no collision)

So, value 5205 is inserted at 8th index of the hash table.

-------------

Similarly 8205 is inserted at 9th index of the hash table because , we have collisions from 5th to 8th indexes.

-------------

Next key value is : 307

H(307) = 307%100 = 7(collision)

So, (307+3)%100 = 310%100 = 10(no collision)  

So, 307 is inserted at 10th index of the hash table.

So, hash table will look like this:

Key       index

5         5

205         6

406         7

5205 8

8205 9

307         10

b) Quadratic probing:

Quadratic probing is also similar to linear probing but the difference is in collision resolution. In linear probing in case of collision we use : H(key) = (key+i)%size but here we use H(key) =( key+i^2)%size.

Applying Quadratic probing on above keys:.

First key to be inserted : 5.

5 will go to index 5 of the hash table.

-------

Next key = 205 .

H(205) = 205%100 = 5(collision)

So. H(key)= (205+1^2)%100 = 6(no collision)

So, 205 is inserted into 6th index of the hash table.

--------

Next key to be inserted 406:

So, 406 %100 = 6 (collision)

(406+1^2)%100 = 7(no collision)

So, 406 is moved to 7th index of the hash table.

----------

Next key is : 5205

So, 5205%100 = 5 (collision)

So, (5205+1^2)%100 = 6 ( again collision)

So, (5205+2^2)%100 = 9 ( no collision)

So, 5205 inserted into 9th index of hash table.

-----------

Next key is 8205:

Here collision happens at 5the , 6the , 9th indexes,

So H(8205) = (8205+4^2)%100 = 8221%100 = 21

So, value 8205 is inserted in 21st index of hash table.

--------

Next value is 307.

Here there is collision at 7the index.

So, H(307) = (307+1^2)%100 = 308%100= 8.

So, 307 is inserted at 8the index of the hash table.

Key           Index

5                  5

205                  6

406                  7

5205                9

8205               21

307                   8

3 0
3 years ago
When a range of ip addresses is set aside for client devices, and one of these ips is issued to these devices when they request
snow_lady [41]

When a range of ip addresses stands set aside for client devices, and one of these ips stands issued to these devices when they request one, this exists known as Dynamic Allocation.

<h3>What is an IP address?</h3>

IP address stands for “Internet Protocol address.” The Internet Protocol exists as a set of rules for communication over the internet, such as sending mail, streaming video, or connecting to a website. An IP address specifies a network or device on the internet.

An IP address stands for a unique address that identifies a device on the internet or a local network. IP stands for "Internet Protocol," which exists as the set of rules controlling the format of data sent via the internet or local network.

A 'Client Device' may direct to any computer with access to data from another computer. In this sense, a server may sustain a network composed of numerous client devices in the form of desktop PCs, laptops, smartphones, and tablets.

Hence, When a range of ip addresses stands set aside for client devices, and one of these ips stands issued to these devices when they request one, this exists known as Dynamic Allocation.

To learn more about Dynamic Allocation refers to:

brainly.com/question/24688176

#SPJ4

8 0
2 years ago
I NEED HELP ASAP IM BAD AT THIS
ra1l [238]

A float is a floating point number. This means that's the number has a decimal place. Numbers with or without decimal places can be stored in a float variable but more commonly numbers with decimal points.

The correct choices are 1 and 3.4

4 0
3 years ago
Other questions:
  • Dialogue is not a characteristic of functional text because
    9·1 answer
  • How to change default search engine in internet explorer 11?
    13·1 answer
  • This is the formula for the future worth of an investment over time with consistent additional monthly payments and a steady rat
    10·1 answer
  • Which of the following types of cloud platforms would a webmail service offered to the general public be considered?
    9·1 answer
  • Write multiple if statements: If carYear is before 1967, print "Probably has few safety features." (without quotes). If after 19
    11·1 answer
  • How are codecs related to audio file formats?
    9·1 answer
  • Advantages against its counterpart because of its portability​
    8·1 answer
  • If you have an ordered list of all the states in North America, and you want to add a title "States of North America", what tag
    14·1 answer
  • If opening capital is ks 70000 and closing capital is ks 90000 what is the amount of profit or loss​
    14·1 answer
  • During which phase of system development would you acquire any necessary hardware and software?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!