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
anzhelika [568]
3 years ago
10

Suppose we use radix sort to sort the English-language strings below using standard lexicographic ordering (i.e. sort in alphabe

tical order). We sort least-to-greatest and consider the numbers in top-to-bottom order when assigning them to bins. Assume the empty string" comes before all letters in lexicographic order. PART TRIP
TARP
ART
TRAP
CHIP

a) (1 point) How many passes are required to sort the strings?
b) (1 point) How many buckets would radix sort allocate to sort the strings?
c) (5 points) For each of the following pairs of words, fill in the circle next to the word that would appear earlier in the list after two passes of radix sort.
i) TRIP or TARP
CHIP or TRIP
iii) ART or PART
iv) PART or TARP
v) TARP or TRAP

d) State the runtime of radix sort on each of the following inputs set as precisely as you can. Include any known constant factors. i) (1 pt) Runtime on English-language strings of length d: ii) (1 pt) Runtime on decimal integers of length d:

Engineering
1 answer:
nlexa [21]3 years ago
7 0

Answer:

a) 4 passes are required to sort the string.

b) 4

c)   i) TARP

    ii) CHIP

    iii) PART

    iv) TARP

    v) TARP

d) O(k+n), n is no. of strings, k is largest no. of character in among the string

   O(d*(n+10)), n is no. of integers

Explanation:

You might be interested in
A design team is working on creating a new energy-efficient light. They have completed the following steps:
Anastaziya [24]
I believe that it is to produce a product
7 0
3 years ago
Read 2 more answers
1. Implement the k-means clustering algorithm either in Java or Python. • The program should be executable with at least 3 param
givi [52]

Answer:

The code for this Question in Python is as follows:

matplotlib inline

from copy import deepcopy

import numpy as np

import pandas as pd

from matplotlib import pyplot as plt

plt.rcParams['figure.figsize'] = (16, 9)

plt.style.use('ggplot')

# Importing the dataset

data = pd.read_csv('xclara.csv')

print(data.shape)

data.head()

# Getting the values and plotting it

f1 = data['V1'].values

f2 = data['V2'].values

X = np.array(list(zip(f1, f2)))

plt.scatter(f1, f2, c='black', s=7)

# Number of clusters

k = 3

# X coordinates of random centroids

C_x = np.random.randint(0, np.max(X)-20, size=k)

# Y coordinates of random centroids

C_y = np.random.randint(0, np.max(X)-20, size=k)

C = np.array(list(zip(C_x, C_y)), dtype=np.float32)

print(C)

# To store the value of centroids when it updates

C_old = np.zeros(C.shape)

# Cluster Lables(0, 1, 2)

clusters = np.zeros(len(X))

# Error func. - Distance between new centroids and old centroids

error = dist(C, C_old, None)

# Loop will run till the error becomes zero

while error != 0:

   # Assigning each value to its closest cluster

   for i in range(len(X)):

       distances = dist(X[i], C)

       cluster = np.argmin(distances)

       clusters[i] = cluster

   # Storing the old centroid values

   C_old = deepcopy(C)

   # Finding the new centroids by taking the average value

   for i in range(k):

       points = [X[j] for j in range(len(X)) if clusters[j] == i]

       C[i] = np.mean(points, axis=0)

   error = dist(C, C_old, None)

# Initializing KMeans

kmeans = KMeans(n_clusters=4)

# Fitting with inputs

kmeans = kmeans.fit(X)

# Predicting the clusters

labels = kmeans.predict(X)

# Getting the cluster centers

C = kmeans.cluster_centers_

fig = plt.figure()

ax = Axes3D(fig)

ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=y)

ax.scatter(C[:, 0], C[:, 1], C[:, 2], marker='*', c='#050505', s=1000)

4 0
4 years ago
Hi njfrenigerg ej5gu5ngu5ntigjk5ng 5itrkgmrj gjrfgj
Vika [28.1K]

Answer:

OMG YOU SPEAK THE I LIKE UR CUT G LANGUAGE

Explanation:

wow ugyfufuyyy yufyufufyu yufuyyuuy uyyfufufu

8 0
3 years ago
Consider a single, porous, spherical, inert mineral particle. The pores inside the particle are filled with liquid water (specie
cluponka [151]

Answer:

Explanation:

kindly check the attachment below for detailed explanations. Thanks

7 0
4 years ago
the increase of current when 15 V is applied to 10000ohm rheostat which is adjusted to 1000ohm value​
Anastasy [175]
Given data:
•) applied voltage = 15 V
•). Resistance = 1000 ohm

Required:
•). The magnitude of current= ?

•••••••••••••SOLUTION•••••••••••••

We can find the relation ship between current, voltage and resistance with the help of Ohms law.

According to ohms law;

V= IR.

Rearranging the above equation;

I= V/ R

Putt the values in the above equation; we get

I= 15V/ 1000ohm

I = 0.015 A( ampere)

••••••••••••••• CONCLUSION•••••••

The value of the current would be 0.15 ampere when Resistance is equal to 1000 and that of Voltage is equal to 15 V.
4 0
3 years ago
Other questions:
  • An object whose mass is 251 kg is located at an elevation of 24 m above the surface of the earth. For g-9.78 ms, determine the g
    5·1 answer
  • 2. A Class B fire includes burning:
    8·1 answer
  • Any programmer who writes a Diophantine equation solver must occasionally encounter an infinite loop.
    13·1 answer
  • A cantilever beam is 4000 mm long span and has a u.d.l. of 0.30 kN/m. The flexural stiffness is 60 MNm². Calculate: 1. Slope 2.
    7·1 answer
  • PythonA group of statisticians at a local college has asked you to create a set of functionsthat compute the median and mode of
    9·1 answer
  • A 2.5 m-high, 4-m-wide, and 80-cm-thick wall of a house has a thermal resistance of 0.0125°c/W. The thermal conductivity of the
    8·1 answer
  • You have been asked to design a steady state treatment device similar to a continuously mixed reactor to treat toluene in an aqu
    11·1 answer
  • Which of the following would NOT be an enforcement responsibility of a local police officer?
    15·1 answer
  • Which of the following is not part of a connecting
    10·1 answer
  • Who invented engineering first?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!