a.) Let T be a binary tree with n nodes. Define the lowest common ancestor (LCA) between two nodes v and w as the lowest node in T that has both v and w as descendants. Given two nodes v and w, write an efficient algorithm, LCA(v, w), for finding the LCA of v and w. Note: A node is a descendant of itself and v.depth gives a depth of a node v.
b.) What is the running time of your algorithm? Give the asymptotic tight bound (Q) of its running time in terms of n and justify your answer.
In: Computer Science
Let f : V mapped to W be a continuous function between two topological spaces V and W, so that (by definition) the preimage under f of every open set in W is open in V : Y is open in W implies f^−1(Y ) = {x in V | f(x) in Y } is open in V. Prove that the preimage under f of every closed set in W is closed in V . Feel free to take V = W = R^n to simplify things. Hint: show that the “preimage of” operation plays nice with set-complements, and then use the fact that every closed set is the complement of some open set. Note that R^n is both open and closed as a subset of itself.
In: Advanced Math
For each of the following statements, determine whether the statement is true or false. If you say the statement is true, explain why and if you say it is false, give an example to illustrate.
(a) If {u, v} is a linearly independent set in a vector space V, then the set {2u + 3v, u + v} is also a linear set independent of V.
(b) Let A and B be two square matrices of the same format. Then det (A + B) = det (A) + det (B).
(c) It is possible to find a non-zero square matrix A such that A^2 = 0.
(d) Let V be a vector space. If {v1, v2,. . . , vn} (with n ≥ 1) is a base of V and if {w1, w2,. . . , wm} is a generator system of V then n ≤ m.
In: Math
V and W are finite dimensional inner product spaces,T: V→W is a linear map
1A: Give an example of a map T from R2 to itself (with the usual inner product) such that〈Tv,v〉= 0 for every map.
1B: Suppose that V is a complex space. Show that〈Tu,w〉=(1/4)(〈T(u+w),u+w〉−〈T(u−w),u−w〉)+(1/4)i(〈T(u+iw),u+iw〉−〈T(u−iw),u−iw〉
1C: Suppose T is a linear operator on a complex space such that〈Tv,v〉= 0 for all v. Show that T= 0 (i.e. that Tv=0 for all v).
In: Advanced Math
Let V = R^2×2 be the vector space of 2-by-2 matrices with real
entries over
the scalar field R. We can define a function L on V by
L : V is sent to V
L = A maps to A^T ,
so that L is the “transpose operator.” The inner product of two
matrices B in R^n×n and C in R^n×n is usually defined to be
<B,C> := trace (BC^T) ,
and we will use this as our inner product on V . Thus when we talk
about
elements B,C in V being orthogonal, it means that <B,C> :=
trace (BC^T) = 0.
Problem 1.
1. First show that L is linear, so that L in B (V ).
2. Now choose a basis for the vector space V = R^2×2, and find the
matrix of
L with respect to your basis.
In: Advanced Math
python
Create a dictionary and insert several English words as keys and the Pig Latin (or any other language) translations as values.
Write a function called bonus that takes as a parameter a dictionary that has names as keys and salaries as values. Your function should increase everyone’s salary in the dictionary by 5%.
Write a function called updateAge that takes as parameters a list of names of people whose birthday it is today, and a dictionary that has names as keys and ages as values. Your function should increment the age in the dictionary of each person whose birthday it is today.
Write a function called seniorList that takes as a parameter a dictionary that has names as keys and class years as values. Your function should return a list of names of students who are graduating in 2020.
Write a function called union that takes as parameters two dictionaries and returns a new dictionary with the entries of both. For common keys, take the value of the first dictionary.
In: Computer Science
What program would you write to solve the following problems and why does it work? Please also comment on other students’ code at least three times. 1) Write code to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x. If x is contained within the list, the values of x only need to be after the elements less than x. The partition element x can appear anywhere in the “right partition”; it does not need to appear between the left and right partitions. Input: 3à5à8à5à10à2à1 (partition=5) Output: 3à1à2à10à5à5à8. 2) Write a method that finds the maximum of two numbers. You should not use if-else or any other comparison operator. 3) Write methods to implement the multiply, subtract and divide operations for integers. The results of all of these are integers. Use only the add operator.
In: Computer Science
In java What program would you write to solve the following problems and why does it work? Please also comment on other students’ code at least three times. 1) Write code to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x. If x is contained within the list, the values of x only need to be after the elements less than x. The partition element x can appear anywhere in the “right partition”; it does not need to appear between the left and right partitions. Input: 3à5à8à5à10à2à1 (partition=5) Output: 3à1à2à10à5à5à8. 2) Write a method that finds the maximum of two numbers. You should not use if-else or any other comparison operator. 3) Write methods to implement the multiply, subtract and divide operations for integers. The results of all of these are integers. Use only the add operator.
In: Computer Science
1) The number of times that student takes an A class, X(X has a
line under) has the discrete uniform pmf: p(x) = 0.25 for x =
1,2,3,4. Recall from earlier course material that this pmf has
E(X)(X has a line under)=5/2 and V(X)(X has a line under)= 15/12. A
random sample of 36 students will be selected and the number of
times that have taken A class will be recorded.
-Determine the probability that the mean of this sample is less
that 3.
2)The lysine composition is soybean meal was measured in 9 random samples resulting in a sample mean of 22.4 g/kg and standard deviation of 1.2g/kg. Construct a 2-sided 99% confidence interval on the population standard deviation. Assume that the population is normally distributed. What is the estimated of the lower bound of this confidence interval?
In: Statistics and Probability
Wage and Tax Statement Data on Employer FICA Tax
Ehrlich Co. began business on January 2, 20Y8. Salaries were paid to employees on the last day of each month, and social security tax, Medicare tax, and federal income tax were withheld in the required amounts. An employee who is hired in the middle of the month receives half the monthly salary for that month. All required payroll tax reports were filed, and the correct amount of payroll taxes was remitted by the company for the calendar year. Early in 20Y9, before the Wage and Tax Statements (Form W-2) could be prepared for distribution to employees and for filing with the Social Security Administration, the employees' earnings records were inadvertently destroyed.
None of the employees resigned or were discharged during the year, and there were no changes in salary rates. The social security tax was withheld at the rate of 6.0% and Medicare tax at the rate of 1.5%. Data on dates of employment, salary rates, and employees’ income taxes withheld, which are summarized as follows, were obtained from personnel records and payroll records:
Employee |
Date First Employed |
Monthly Salary |
Monthly Income Tax Withheld |
||
| Arnett | Jan. 2 | $3,500 | $490 | ||
| Cruz | Oct. 1 | 5,500 | 990 | ||
| Edwards | Apr. 16 | 2,600 | 325 | ||
| Harvin | Nov. 1 | 2,200 | 275 | ||
| Nicks | Jan. 16 | 5,650 | 1,271 | ||
| Shiancoe | Dec. 1 | 3,800 | 589 | ||
| Ward | Feb. 1 | 6,300 | 1,355 | ||
Required:
1. Calculate the amounts to be reported on each employee's Wage and Tax Statement (Form W-2) for 20Y8.
Note: Round amounts to the nearest whole dollar and enter all amounts as positive values.
Employee |
Gross Earnings |
Federal Income Tax Withheld |
Social Security Tax Withheld |
Medicare Tax Withheld |
||||
| Arnett | $ | $ | $ | $ | ||||
| Cruz | ||||||||
| Edwards | ||||||||
| Harvin | ||||||||
| Nicks | ||||||||
| Shiancoe | ||||||||
| Ward | ||||||||
| $ | $ | |||||||
2. Calculate the following employer payroll taxes for the year: (a) social security; (b) Medicare; (c) state unemployment compensation at 5.4% on the first $10,000 of each employee’s earnings; (d) federal unemployment compensation at 0.6% on the first $10,000 of each employee’s earnings; (e) total.
Note: Round amounts to the nearest whole dollar and enter all amounts as positive values.
| (a) | $ |
| (b) | |
| (c) | |
| (d) | |
| (e) | $ |
Feedback
Consider each employee's date of hire. Remember there is a limit on how much the employer pays for state and feder
In: Accounting