Extra information: sample input and output: 1. Design, code, and test a C program to compute the
Fantastic news! We've Found the answer you've been seeking!
Question:
Extra information:
sample input and output:
Transcribed Image Text:
1. Design, code, and test a C program to compute the maximum interleave factor i for an integer sequence X such that the resulting interleaved sequence x(i) is a subsequence of another integer sequence A. The input will be formatted as follows: a. Two integers giving the number of integers in sequences A and X (i.e. A and X). b. Each integer of A, one per line. c. The number -999999999 on a line by itself. d. Each integer of X, one per line. e. The number -999999999 on a line by itself. The input is to be read from standard input as one of 1) keyboard typing, 2) a shell redirect (<) from a file, or 3) cut-and-paste. Do NOT prompt for a file name! The interleaved sequence x(i) for a sequence X and an interleave factor i 2 0 results from repeating each element of X exactly i times "in place". So, if X = abbeda, x(2) is aabbbbeeddaa and x(3) is aaabbbbbbcccdddaaa. x(0) is always the empty sequence. (Aside for those with CSE 3315 background: X is the ith power of sequence X. So, if X= abbeda, X² is abbedaabbcda and X³ is abbedaabbcdaabbeda by concatenation.) A sequence U is a subsequence of a sequence V if there is at least one way to delete V-U elements from V to leave the sequence U. So, U = cba is a subsequence of V = abcabcabe by performing these deletions from Vabcabeabe. The output of your program is the trace of the successes and failures of a binary search (including "low", "mid", and "high") for determining the maximum interleave factor that satisfies the subsequence condition. The last line output should provide the maximum interleave factor. 1. Design, code, and test a C program to compute the maximum interleave factor i for an integer sequence X such that the resulting interleaved sequence x(i) is a subsequence of another integer sequence A. The input will be formatted as follows: a. Two integers giving the number of integers in sequences A and X (i.e. A and X). b. Each integer of A, one per line. c. The number -999999999 on a line by itself. d. Each integer of X, one per line. e. The number -999999999 on a line by itself. The input is to be read from standard input as one of 1) keyboard typing, 2) a shell redirect (<) from a file, or 3) cut-and-paste. Do NOT prompt for a file name! The interleaved sequence x(i) for a sequence X and an interleave factor i 2 0 results from repeating each element of X exactly i times "in place". So, if X = abbeda, x(2) is aabbbbeeddaa and x(3) is aaabbbbbbcccdddaaa. x(0) is always the empty sequence. (Aside for those with CSE 3315 background: X is the ith power of sequence X. So, if X= abbeda, X² is abbedaabbcda and X³ is abbedaabbcdaabbeda by concatenation.) A sequence U is a subsequence of a sequence V if there is at least one way to delete V-U elements from V to leave the sequence U. So, U = cba is a subsequence of V = abcabcabe by performing these deletions from Vabcabeabe. The output of your program is the trace of the successes and failures of a binary search (including "low", "mid", and "high") for determining the maximum interleave factor that satisfies the subsequence condition. The last line output should provide the maximum interleave factor.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
On your local network, you have a Linux apache web server and an Oracle database running on another Linux server. Describe how SSH allows you to login and communicate between these two local systems...
-
For this assignment, you will be reading about a case that appeared in the news in early 2019. You will then write a response to this case in which you demonstrate an understanding of the basic...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
How does a project manager calculate start and finish times?
-
(a) Estimate the area under the graph of f(x) = 1 + x2 from x = 1 to x = 2 using three rectangles and right endpoints. Then improve your estimate by using six rectangles. Sketch the curve and the...
-
If a 5 percent note receivable for $100,000 is created on January 1, 2018, and it has a maturity date of December 31, 2021, a. No interest revenue will be recorded in 2018. b. The note receivable...
-
In a market with \(N\) securities and \(M\) futures, where \(\left(S_{1}, \cdots, S_{N} ight)\) is the present values vector and \(\left(S_{1}^{j}(T), \cdots, S_{N}^{j}(T) ight)\) the future values...
-
The image of a tree just covers the length of a plane mirror 4.00 cm tall when the mirror is held 35.0 cm from the eye. The tree is 28.0 m from the mirror. What is its height?
-
LO 3, 4 P1-71B. (Learning Objectives 3, 4: Apply the accounting equation; evaluate business operations; construct a balance sheet) The manager of Parker Design, Inc., prepared the company's balance...
-
Mr. M has been employed as an engineer by A Ltd., a company incorporated in Hong Kong. During the year ended 31 March 2019, Mr. M had the following income and expenditure. A monthly salary of...
-
Suppose you take out a five-year car loan for $18000, paying an annual interest rate of 5%. You make monthly payments of $340 for this loan. Complete the table below as you pay off the loan. 5%...
-
A country with a persistent trade surplus is being pressured to let its currency appreciate. Which of the following best describes the adjustment that must occur if currency appreciation is to be...
-
What are the two most important points to keep in mind when dealing with price resistance?
-
Explain how ratio analysis can be used to help interpret income statement data.
-
What are the costs involved in the change?
-
What services might a salesperson consider providing in an effort to strengthen their existing partnership with customers?
-
Find the values of constants a and b such that f is contin- uous at every real number. f(x) = 2+(4a+1)x+4a 1-2 ear+b 4ax 1 if x < -1 if -1 x 1 if x > 1
-
Interest Compounded Annually. When P dollars is invested at interest rate i, compounded annually, for t years, the investment grows to A dollars, where A = P(1 + i) t . Trevor's parents deposit $7800...
-
Ann hires a nanny to watch her two children while she works at a local hospital. She pays the 19-year-old nanny $125 per week for 48 weeks during the current year. a. What is the employer's portion...
-
Abigail (Abby) Boxer is a single mother working as a civilian accountant for the U.S. Army. Her Social Security number is 676-73-3311 and she lives at 3456 Alamo Way, San Antonio, TX 78249. Helen,...
-
Your supervisor has asked you to research the following situation concerning Owen and Lisa Cordoncillo. Owen and Lisa are brother and sister. In May 2012, Owen and Lisa exchange business pickup...
-
For the particular case of hard spheres, the pressure in the virial equation of state is determined by evaluating the pair correlation function at contact. Write the pair correlation function as...
-
Use a virial expansion approach to determine the first few nontrivial order contributions to the pair correlation function \(g(r)\) in \(d\) dimensions. Show that the pair correlation function is of...
-
Show that, in the case of a degenerate gas of fermions \(\left(T \ll T_{F} ight)\), the correlation function \(g(r)\), for \(r \gg \hbar / p_{F}\), reduces to the expression \[g(r)-1=-\frac{3(m k...
Study smarter with the SolutionInn App