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
boyakko [2]
3 years ago
10

Please help asaaappp!!!!!!!!!!

Mathematics
1 answer:
Aleksandr [31]3 years ago
8 0
I think C is the correct awnser
You might be interested in
Using linked lists or a resizing array; develop a weighted quick-union implementation that removes the restriction on needing th
balu736 [363]

Answer:

Step-by-step explanation:

package net.qiguang.algorithms.C1_Fundamentals.S5_CaseStudyUnionFind;

import java.util.Random;

/**

* 1.5.20 Dynamic growth.

* Using linked lists or a resizing array, develop a weighted quick-union implementation that

* removes the restriction on needing the number of objects ahead of time. Add a method newSite()

* to the API, which returns an int identifier

*/

public class Exercise_1_5_20 {

public static class WeightedQuickUnionUF {

private int[] parent; // parent[i] = parent of i

private int[] size; // size[i] = number of sites in subtree rooted at i

private int count; // number of components

int N; // number of items

public WeightedQuickUnionUF() {

N = 0;

count = 0;

parent = new int[4];

size = new int[4];

}

private void resize(int n) {

int[] parentCopy = new int[n];

int[] sizeCopy = new int[n];

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

parentCopy[i] = parent[i];

sizeCopy[i] = size[i];

}

parent = parentCopy;

size = sizeCopy;

}

public int newSite() {

N++;

if (N == parent.length) resize(N * 2);

parent[N - 1] = N - 1;

size[N - 1] = 1;

return N - 1;

}

public int count() {

return count;

}

public int find(int p) {

// Now with path compression

validate(p);

int root = p;

while (root != parent[root]) {

root = parent[root];

}

while (p != root) {

int next = parent[p];

parent[p] = root;

p = next;

}

return p;

}

// validate that p is a valid index

private void validate(int p) {

if (p < 0 || p >= N) {

throw new IndexOutOfBoundsException("index " + p + " is not between 0 and " + (N - 1));

}

}

public boolean connected(int p, int q) {

return find(p) == find(q);

}

public void union(int p, int q) {

int rootP = find(p);

int rootQ = find(q);

if (rootP == rootQ) {

return;

}

// make smaller root point to larger one

if (size[rootP] < size[rootQ]) {

parent[rootP] = rootQ;

size[rootQ] += size[rootP];

} else {

parent[rootQ] = rootP;

size[rootP] += size[rootQ];

}

count--;

}

}

public static void main(String[] args) {

WeightedQuickUnionUF uf = new WeightedQuickUnionUF();

Random r = new Random();

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

System.out.printf("\n%2d", uf.newSite());

int p = r.nextInt(i+1);

int q = r.nextInt(i+1);

if (uf.connected(p, q)) continue;

uf.union(p, q);

System.out.printf("%5d-%d", p, q);

uf.union(r.nextInt(i+1), r.nextInt(i+1));

}

}

}

8 0
3 years ago
A city park has a train ride. The profit the park earns from the daily train rides is based on the number of passengers,
butalik [34]

Answer:

aljfHlfzlhczkhkdKhfLufzlutsljfsljfz

5 0
3 years ago
If something costs $105.00 , and you have a 35% discount, how much would it be ?
leonid [27]
The answer would be 68.25
5 0
3 years ago
Read 2 more answers
Use the graph below to fill in the blank with the correct number:<br><br> f(0) = _______
vagabundo [1.1K]
1
When the input is 0 (horizontal axis), the output is 1 (vertical axis).
3 0
3 years ago
I will give you brainliest to whoever helps me answer this. Please hurry
laila [671]
Y= 13.18x + 36 Blank 1: 13.18 & Blank 2: 36
6 0
3 years ago
Other questions:
  • A jar contains 2 sugar cookies, 5 peanut butter cookies, and 3 chocolate chip cookies.What is the probability of randomly choosi
    7·2 answers
  • You have a 10% sugar solution and a 30% sugar solution, but you need a 25% sugar solution to fill your
    11·1 answer
  • 1. What is the area of a rectangular crystal face that has one side measuring
    5·1 answer
  • The speedometer needle in a car is 2.5 inches long. When accelerating from 0 to 60 miles per hour the needle
    14·1 answer
  • Write the improper fraction as a mixed number 10/7
    9·2 answers
  • The lowest number was 11
    13·1 answer
  • (19+8)x11+4<br> Order of operations
    11·2 answers
  • A shopper wants to ensure she has enough cash to purchase a $25 cell phone, so she asks a clerk what the total will be with the
    6·1 answer
  • Question 2 (2 points)
    13·1 answer
  • やあ! 退屈だから話したいだけ<br> wanna talk ?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!