Q, Haskell.
I need to define function encode and decode. Details about the functions are provided in code.
-- | encode -- -- Given a string, return a list of encoded values of type (Int,Char) -- -- >>> encode ['a','a','a','a','b','c','c','a','a','d','e','e','e','e'] -- [(4,'a'),(1,'b'),(2,'c'),(2,'a'),(1,'d'),(4,'e')] -- -- >>> encode "hello" -- [(1,'h'),(1,'e'),(2,'l'),(1,'o')] -- -- >>> encode [] -- [] -- encode :: String -> [(Int,Char)] encode = undefined -- | decode -- -- Given a list of encoded values of type (Int,Char), generate a string corresponding to -- this encoding. -- -- If the first element of any pair in the list is equal to zero or negative, -- skip the corresponding character in the output string, -- while still providing decodings for the remaining characters. -- -- -- >>> decode [(4,'a'),(1,'b'),(2,'c'),(2,'a'),(1,'d'),(4,'e')] -- "aaaabccaadeeee" -- -- >>> decode [] -- "" -- -- >>> decode [(-4,'a')] -- "" -- -- >>> decode [(3,'c'),(-4,'a'),(5,'b')] -- "cccbbbbb" -- -- >>>decode [(3,'c'),(0,'a'),(5,'b')] -- "cccbbbbb" -- -- prop> \x -> x == decode (encode x) -- decode :: [(Int,Char)] -> String decode = undefined
In: Computer Science
Show that (1 + 2 +. . .+n)2 > 12 +. . .+ n2, for n ≥ 2.
In: Computer Science
A report by the Gallup Poll stated that on average a woman visits her physician 5.8 times a year. A researcher randomly selects 20 women and obtained these data. The population standard deviation is 2
3 2 1 3 7 2 9 4 6 6 8 0 5 6 4 2 1 3 4 1
At α= 0.01 can it be concluded that the average is still 5.8 visits per year? Use the traditional method.
In: Statistics and Probability
Chapter 3.6, Problem 20E in Introduction to Linear Algebra (5th Edition)
Find the basis for the null space and the range of the given matrix. Then use Gram-Schmidt to obtain the orthagonal bases.
| 1 | 3 | 10 | 11 | 9 |
| -1 | 2 | 5 | 4 | 1 |
| 2 | -1 | -1 | 1 | 4 |
In: Math
24) What occurs during the proliferative phase of the uterine cycle? Select all that apply (2 points)
A) Spiral glands become necrotic
B) Spiral arteries are dilated
C) Spiral glands form in the functional layer
D) Spiral glands secrete glycogen
E) Epithelial cells rapidly divide
18) Which of the following conditions is an age-related change for menopause? (1 point)
A) Hypertrophy and repositioning of the uterus
B) Increased mucus secretion in the uterus
C) Decreased hormone production by ovaries
D) Hot flashes, increased sweating, and vasoconstriction of blood vessels
E) Increased proliferation of follicles
4) What is the proper arrangement of the four structures listed below into the order in which sperm pass from the testis to the urethral meatus? (1 point)
1. Ductus deferens
2. Urethra
3. Ejaculatory duct
4. Epididymis
5. Bulbourethral glands
6. Seminal vesicles
A) 1, 6, 3, 2
B) 4, 3, 5, 2
C) 4, 1, 6, 2
D) 4, 1, 3, 2
E) 1, 4, 3, 2
7) Select all of the following that are functions of the accessory glands of the male reproductive system. (2 points)
A) Spermatocyte creation
B) Supplying nutrients for gamete motility
C) Moving fluids along the reproductive tract
D) Buffer production
E) Hormone secretion for fertility regulation
In: Anatomy and Physiology
Develop the best logistic regression model that can predict the
wage by using the
combination of any following variables: total unit (X2),
constructed unit (X3), equipment
used (X4), city location (X5) and total cost of a project (X6).
Make sure that you partition
your data with 60% training test, 40% validation test, and default
seed of 12345 before
running the logistic regression (15 points)
| Wage - X1 | Total Unit - X2 | Contracted Units - X3 | Equipment Used - X4 | City Location - X5 | Total Cost - X6 |
| 0 | 50 | 5 | 2 | 1 | 83680 |
| 1 | 25 | 2 | 3 | 1 | 73604 |
| 0 | 55 | 1 | 2 | 1 | 101562 |
| 0 | 68 | 3 | 2 | 1 | 91055 |
| 1 | 35 | 3 | 2 | 1 | 41790 |
| 0 | 24 | 2 | 2 | 1 | 75770 |
| 1 | 12 | 2 | 4 | 1 | 37420 |
| 0 | 20 | 1 | 2 | 1 | 58000 |
| 1 | 48 | 2 | 2 | 1 | 97800 |
| 0 | 36 | 2 | 3 | 1 | 73960 |
| 0 | 40 | 1 | 2 | 1 | 98720 |
| 1 | 39 | 4 | 2 | 1 | 54190 |
| 0 | 26 | 1 | 1 | 1 | 67800 |
| 1 | 25 | 1 | 4 | 1 | 66760 |
| 0 | 70 | 3 | 3 | 2 | 88055 |
In: Statistics and Probability
The data set shown below contains the number of hurricanes that occurred each year over a 14-year period. Some scientists claim that there has been
an increasean increase
in the number of hurricanes as the years progressed. Complete parts a) through d).
|
Year |
11 |
22 |
33 |
44 |
55 |
66 |
77 |
88 |
99 |
1010 |
1111 |
1212 |
1313 |
1414 |
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
# |
11 |
22 |
22 |
00 |
22 |
33 |
33 |
11 |
11 |
22 |
44 |
11 |
11 |
00 |
a) Create a histogram of these data.
Choose the correct histogram below.
A.
0506# of Hurricanes
A histogram has a horizontal axis labeled "Number of Hurricanes" from 0 to 5 in increments of 1 and a vertical axis labeled from 0 to 6 in increments of 1. The histogram has vertical bars of width 1 starting at the horizontal axis value 0. The heights of the bars are as follows, where the left horizontal axis label is listed first and the height is listed second: 0, 2; 1, 5; 2, 4; 3, 2; 4, 1.
B.
0506# of Hurricanes
A histogram has a horizontal axis labeled "Number of Hurricanes" from 0 to 5 in increments of 1 and a vertical axis labeled from 0 to 6 in increments of 1. The histogram has vertical bars of width 1 starting at the horizontal axis value 0. The heights of the bars are as follows, where the left horizontal axis label is listed first and the height is listed second: 0, 1; 1, 2; 2, 4; 3, 3; 4, 4.
C.
0506# of Hurricanes
A histogram has a horizontal axis labeled "Number of Hurricanes" from 0 to 5 in increments of 1 and a vertical axis labeled from 0 to 6 in increments of 1. The histogram has vertical bars of width 1 starting at the horizontal axis value 0. The heights of the bars are as follows, where the left horizontal axis label is listed first and the height is listed second: 0, 2; 1, 2; 2, 3; 3, 5; 4, 2.
D.
0506# of Hurricanes
A histogram has a horizontal axis labeled "Number of Hurricanes" from 0 to 5 in increments of 1 and a vertical axis labeled from 0 to 6 in increments of 1. The histogram has vertical bars of width 1 starting at the horizontal axis value 0. The heights of the bars are as follows, where the left horizontal axis label is listed first and the height is listed second: 0, 2; 1, 3; 2, 4; 3, 3; 4, 2.
b) Describe the distribution.
Is the distribution uniform, unimodal, or bimodal?
A.The distribution is
uniformuniform.
B.The distribution is
unimodalunimodal.
C.
The distribution is bimodal.
Is the distribution symmetric or skewed?
A.The distribution is
skewed to the rightskewed to the right.
B.The distribution is
skewed to the leftskewed to the left.
C.The distribution is
symmetricsymmetric.
Which of the following statements best describes the center of the distribution?
A.The center is best described by the mean,
1.641.64
hurricanes.
B.The center is best described by the median,
1.51.5
hurricanes.
C.The center is best described by the
medianmedian,
22
hurricanes.The range of the data is
nothing
hurricanes.
Describe any unusual features.
A.
There is one year with an unusually low number of hurricanes.
B.
There are no unusual features.
C.As the years progressed, the number of hurricanes
increasedincreased.
D.
There is one year with an unusually large number of hurricanes.
c) Create a time series plot of these data.
Choose the correct graph below.
A.
01606Year# of Hurricanes
A coordinate system has a horizontal axis labeled Year from 0 to 16 in increments of 2 and a vertical axis labeled Numer of Hurricanes from 0 to 6 in increments of 1. Fourteen plotted points are connected by line segments from left to right and have coordinates as follows: (1, 0), (2, 0), (3, 1), (4, 1), (5, 1), (6, 1), (7, 1), (8, 2), (9, 2), (10, 2), (11, 2), (12, 3), (13, 3), (14, 4).
B.
01606Year# of Hurricanes
A coordinate system has a horizontal axis labeled Year from 0 to 16 in increments of 2 and a vertical axis labeled Numer of Hurricanes from 0 to 6 in increments of 1. Fourteen plotted points are connected by line segments from left to right and have coordinates as follows: (1, 0), (2, 1), (3, 1), (4, 4), (5, 2), (6, 1), (7, 1), (8, 3), (9, 3), (10, 2), (11, 0), (12, 2), (13, 2), (14, 1).
C.
01606Year# of Hurricanes
A coordinate system has a horizontal axis labeled Year from 0 to 16 in increments of 2 and a vertical axis labeled Numer of Hurricanes from 0 to 6 in increments of 1. Fourteen plotted points are connected by line segments from left to right and have coordinates as follows: (1, 1), (2, 2), (3, 2), (4, 0), (5, 2), (6, 3), (7, 3), (8, 1), (9, 1), (10, 2), (11, 4), (12, 1), (13, 1), (14, 0).
D.
01606Year# of Hurricanes
A coordinate system has a horizontal axis labeled Year from 0 to 16 in increments of 2 and a vertical axis labeled Numer of Hurricanes from 0 to 6 in increments of 1. Fourteen plotted points are connected by line segments from left to right and have coordinates as follows: (1, 0), (2, 1), (3, 1), (4, 1), (5, 2), (6, 2), (7, 3), (8, 4), (9, 3), (10, 2), (11, 2), (12, 1), (13, 1), (14, 0).
d) Discuss the time series plot. Does this graph support the claim of these scientists?
The time series plot
▼
does
does not
support the claim that the number of hurricanes has
▼
decreased
increased
as the years progressed.
In: Statistics and Probability
A message has been encrypted by Bob using row transposition cipher to give the following ciphertext:
TTNA APTM TSUO AODW COIX KNLY PETZ
However when Bob shared the key with Alice, it got copied multiple times and looks like:
…. 6 7 4 3 1 2 5 6 7 4 3 1 2 5 6 7 4 3 1 2 5 6 7 4 3 1 2 5 6 7 4 3 1 2 ……
You see a series of numbers repeating. However you do not know which number
to start the key with.
How many keys will you have to try to find the correct key (maximum keys you may have to try)?
Find the correct key. Describe the process you followed to find the key.
Decrypt the ciphertext given above and find the plaintext.
In: Computer Science