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
melamori03 [73]
2 years ago
6

Given an array arr of type int , along withtwo int variables i and j , write some code thatswaps the values of arr[i] and arr[j]

. Declare anyadditional variables as necessary.
Computers and Technology
1 answer:
nignag [31]2 years ago
4 0

Answer:

Hi! I suppose that no matter the programming language that you need the algorithm, so I will do in pseudo-code.

 

myArray [int] = [1,2,3,4,5,"Hello","World"];

int i = 5;

int j = 2;

// Save the previous value before the swap

aux1 = myArray[i];

aux2 = myArray[j];

// Swap i & j

myArray[j] = aux1;

myArray[i] = aux2;

print(myArray)

// Out : myArray = [1,2,"Hello",4,5,3,"World"]  

Explanation:

The trick is to save in two variables the previous value of the two position before change the array, just like that you can change the array and make the swap without lost the values.

I hope it's help you.

You might be interested in
Which of these agents of education empowers the other..........
Tomtit [17]

Answer:

B. school

Explanation:

Because the school is where you learn and gain knowledge

4 0
2 years ago
Read 2 more answers
Define Technology. Explain the term.​
aleksandrvk [35]

Answer:

Technology refers to methods, systems, and devices which are the result of scientific knowledge being used for practical purposes. Technology is changing fast. They should be allowed to wait for cheaper technologies to be developed.

7 0
3 years ago
Read 2 more answers
What is a "telescreen"? How is it different from the televisions we know? Is it possible to make a television that could see and
mars1129 [50]

Answer:

  1. Telescreens are devices that operate as televisions, security cameras, and microphones.
  2. A television is an electronic communication medium that allows the transmission of real-time visual images, and often sound while a telescreen is a television and security camera-like device used to keep things or people under constant surveillance, thus eliminating the chance of secret conspiracies.
  3. It could be employed in secretly investigating criminals and terrorists.
  4. It could also play a major role in politics by investigating suspicious government officials and those that plan Ill towards a nation.
  5. It would definitely be a great idea to install one of such.

Explanation:

8 0
3 years ago
The ______ view connects perceptual capabilities to information available in the world of the perceiver. Multiple choice questio
jekas [21]

Answer:

Ecological

Explanation:

Please mark brainliest

4 0
2 years ago
Which company introduce the first Minicomputer in 1960.​
madreJ [45]

Answer:

<em>t</em><em>h</em><em>e</em><em> </em><em>f</em><em>i</em><em>r</em><em>s</em><em>t</em><em> </em><em>m</em><em>i</em><em>n</em><em>i</em><em>c</em><em>o</em><em>m</em><em>p</em><em>u</em><em>t</em><em>e</em><em>r</em><em> </em><em>w</em><em>a</em><em>s</em><em> </em><em>i</em><em>n</em><em>t</em><em>r</em><em>o</em><em>d</em><em>u</em><em>c</em><em>e</em><em> </em><em>b</em><em>y</em><em> </em><em>d</em><em>i</em><em>g</em><em>i</em><em>t</em><em>a</em><em>l</em><em> </em><em>e</em><em>q</em><em>u</em><em>i</em><em>p</em><em>m</em><em>e</em><em>n</em><em>t</em><em> </em><em>c</em><em>o</em><em>r</em><em>o</em><em>p</em><em>o</em><em>r</em><em>a</em><em>t</em><em>i</em><em>o</em><em>n</em><em> </em><em>(</em><em>D</em><em>E</em><em>C</em><em>)</em><em>a</em><em>f</em><em>t</em><em>e</em><em>r</em><em> </em><em>t</em><em>h</em><em>e</em><em>s</em><em>e</em><em> </em><em>I</em><em>B</em><em>M</em><em> </em><em>c</em><em>o</em><em>r</em><em>p</em><em>o</em><em>r</em><em>a</em><em>t</em><em>i</em><em>o</em><em>n</em><em> </em><em>a</em><em>l</em><em>s</em><em>o</em><em> </em><em>m</em><em>i</em><em>n</em><em>i</em><em>c</em><em>o</em><em>m</em><em>p</em><em>u</em><em>t</em><em>e</em><em>r</em><em> </em><em>f</em><em>o</em><em>r</em><em> </em><em>e</em><em>x</em><em>a</em><em>m</em><em>p</em><em>l</em><em>e</em><em> </em><em>P</em><em>D</em><em>P</em><em>–</em><em>1</em><em>1</em>

7 0
3 years ago
Read 2 more answers
Other questions:
  • You accidentally find someone's password and use it to get into a system. this is hacking.
    15·1 answer
  • This library function returns a random floating point number within a specified range of values. The function returns a random f
    12·1 answer
  • How can you keep your files organized on your computer?
    13·2 answers
  • Can multiple processors can be installed in a single processor housing?
    14·2 answers
  • ¿Es especial que mi cumpleaños sea el día de San Valentín?<br><br> si o no
    11·2 answers
  • Write a program that asks the user for two file names. The first file will be opened for input and the second file will be opene
    8·1 answer
  • Td udutdiydiyfyfigciydutdutdtt
    10·2 answers
  • mapa mental con la explicación de que medios de comunicación y redes sociales intervienen en la construcción de tu identidad​
    10·1 answer
  • 60 POINTS IF YOU GET IT RIGHT
    6·2 answers
  • Which option on the Format tab is used to modify particular portions of the chart?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!