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

Will give brainliest and good amount of points, no false answers.

Computers and Technology
1 answer:
nlexa [21]3 years ago
7 0

The problem with the swap function is that it loses the value at the first index, as soon as it gets overwritten by the value at the second index. This happens in the first statement. To fix it, you need a helper variable.

First you're going to "park" the index at the first index in that helper variable, then you can safely overwrite it with the value at the second index. Then finally you can write the parked value to the second index:

var swap = function(array, firstIndex, secondIndex) {

let helper = array[firstIndex];

array[firstIndex]  = array[secondIndex];

array[secondIndex] = helper;

};

I hope this makes sense to you.

You might be interested in
If a speaker repeats a point, it is likely _____.
zloy xaker [14]

I’m pretty sure it’s either A or D

4 0
3 years ago
Read 2 more answers
Which formula is used to measure accuracy?
shepuryov [24]
<span>Gross WPM – Net WPM x 100
So B</span>
7 0
3 years ago
The Polish mathematician Wacław Sierpiński described the pattern in 1915, but it has appeared in Italian art since the 13th cent
soldi70 [24.7K]

Answer:

/ Sierpinski.java

public class Sierpinski {

     // method to find the height of an equilateral triangle with side length =

     // length

     public static double height(double length) {

           // formula= length*sqrt(3)/2

           double h = (length * Math.sqrt(3)) / 2.0;

           return h;

     }

     // method to draw a filled triangle (pointed downwards) with bottom vertex

     // x,y

     public static void filledTriangle(double x, double y, double length) {

           // finding height

           double h = height(length);

           // filling triangle as a polygon

           // passing x, x-length/2, x+length/2 as x coordinates

           // and y, y+h, y+h as y coordinates

           StdDraw.filledPolygon(new double[] { x, x - (length / 2.0),

                       x + (length / 2.0) }, new double[] { y, y + h, y + h });

     }

     // method to draw an n level sierpinski triangle

     public static void sierpinski(int n, double x, double y, double length) {

           // checking if n is above 0 (base condition)

           if (n > 0) {

                 // drawing a filled triangle with x, y as bottom coordinate, length

                 // as side length

                 filledTriangle(x, y, length);

                 // drawing the triangle(s) on the top

                 sierpinski(n - 1, x, y + height(length), length / 2);

                 // drawing the triangle(s) on the left side

                 sierpinski(n - 1, x - (length / 2.0), y, length / 2);

                 // drawing the triangle(s) on the right side

                 sierpinski(n - 1, x + (length / 2.0), y, length / 2);

           }

     }

     public static void main(String[] args) {

           // parsing first command line argument as integer, if you dont provide

           // the value while running the program, this program will cause

           // exception.

           int n = Integer.parseInt(args[0]);

           // length of the outline triangle

           double length = 1;

           // finding height

           double h = height(length);

           // drawing a triangle (pointed upwards) to represent the outline.

           StdDraw.polygon(new double[] { 0, length / 2, length }, new double[] {

                       0, h, 0 });

           // drawing n level sierpinski triangle(s) with length / 2, 0 as x,y

           // coordinates and length / 2 as initial side length

           sierpinski(n, length / 2, 0, length / 2);

     }

}

7 0
3 years ago
What are informational sessions?
arsen [322]

Answer:B

Explanation:

7 0
3 years ago
While investigating the settings on your SOHO router, you find two IP addresses reported on the device’s routing table, which is
Semenov [28]

Answer:

Explanation:

Always the getaway is the first device in a network, and for that was assigned this IP address 192.168.2.1, is the first address of the block, a network getaway gives us interoperability between networks and contains devices, and is a protocol translator, this is a piece of hardware used for telecommunication networks.

8 0
3 years ago
Other questions:
  • In evaluating the precedence rules used by Python, what statement is accurate? a. Addition and subtraction are evaluated after a
    8·2 answers
  • With which network connection type does the vm obtain ip addressing information from its host?
    11·1 answer
  • Write a program that accepts any number of scores ranging from 0 to 10
    14·1 answer
  • the tool that is used on the form to display text that the user cannot change is a. textbox b. label c. button​
    9·1 answer
  • Why don’t the ads on Brainly load anymore
    14·2 answers
  • What is digital marketing?
    5·1 answer
  • Old systems can be useful when designing new computer software.<br> True or False
    7·2 answers
  • A DTP firm has published and printed fliers for an upcoming fundraising event. In which section of the flyer would you find the
    10·1 answer
  • Why do companies use online collaborative productivity software.
    15·1 answer
  • Taran wants to work in the technology field but is unsure of which career to pursue. He has been told he has strong people skill
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!