Once the suffix array is constructed, the short routine shown in Figure 12.50 can be invoked from
Question:
a. In the code, what does rank[i] represent?
b. Suppose that LCP[rank[i] ] = h. Show that LCP[rank[i+1] ] ¥ h 1.
c. Show that the algorithm in Figure 12.50 correctly computes the LCP array.
d. Prove that the algorithm in Figure 12.50 runs in linear time.
Figure 12.50 LCP array construction from suffix array
Transcribed Image Text:
* Create the LCP array from the suffix array * @param s the input array populated from 0..N-1, with available pos N * @param sa the already-computed suffix array 0..N-1 * @param LCP the resulting LCP array 0..N-1 */ public static void makeLCPArray ( int [] s, int [ ] sa, int [] LCP ) int N = sa.length; int [] rank = new int[ N ]; 10 11 s[ N] = -1; 12 for( int i = 0; i < N; i+ ) rank[ sa[ i]] = i; 13 %3D 14 15 int h = 0; for( int i = 0; i < N; i++ ) if( rank[ 1] > 0 ) 16 17 18 { 19 int j = sa[ rank[ i] - 1 ]; 20 21 while( s[ i +h ] == s[ j + h] ) 22 %3D 23 htt; 24 LCP[ rank[ i]] = h; if( h > 0 ) 25 26 27 h--; 28 29
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 80% (5 reviews)
a We see that for all i ranksai i Thus rank and sa are inverses of each other The sa array gives the list of suffixes in alphabetical order In other w...View the full answer
Answered By
Joseph Mwaura
I have been teaching college students in various subjects for 9 years now. Besides, I have been tutoring online with several tutoring companies from 2010 to date. The 9 years of experience as a tutor has enabled me to develop multiple tutoring skills and see thousands of students excel in their education and in life after school which gives me much pleasure. I have assisted students in essay writing and in doing academic research and this has helped me be well versed with the various writing styles such as APA, MLA, Chicago/ Turabian, Harvard. I am always ready to handle work at any hour and in any way as students specify. In my tutoring journey, excellence has always been my guiding standard.
4.00+
1+ Reviews
10+ Question Solved
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Question Posted:
Students also viewed these Computer Sciences questions
-
Draw a suffix tree and show the suffix array and LCP array for the following input strings: a. ABCABCABC b. MISSISSIPPI
-
A system of the form shown in Figure 12.1 has where 3 p 5,0 q 1, and 1 r 2. we will use a compensator with all real poles and zeros. Select an appropriate compensator to achieve robust...
-
A Latin square is an n-by-n array filled with n different Latin letters, each occurring exactly once in each row and once in each column. Write a program that prompts the user to enter the number n...
-
Identify an accurate sentence about parenting in the United States. a. Fathers of toddlers play more roughly with daughters than with sons. b. During the first year, fathers treat boys and girls as...
-
A 90.0-kg fullback running east with a speed of 5.00 m/s is tackled by a 95.0-kg opponent running north with a speed of 3.00 m/s. If the collision is perfectly inelastic, (a) Calculate the speed and...
-
Solve the following problem. Tamara earned $74 000 in 2016. If the Consumer Price Index in 2016 was 128.4 and in 2017 was 130.4, what did Tamara have to earn in 2017 just to keep up with inflation?
-
1 To what extent can the failure of the new bonus scheme be attributed to inadequate cross-cultural communication?
-
The FASB has been working on a conceptual framework for financial accounting and reporting and has issued seven Statements of Financial Accounting Concepts. These SFAC s are intended to set forth...
-
When Magdalena's outside basis is $157,500, she receives a liquidating distribution of $39,375 cash and a proportionate share of inventory having a partnership basis of $55,125 and a fair market...
-
Barnard and Associates, a law firm, paid $ 18,000 for twelve months rent in advance on October 1 of the current year. Barnard recorded the full amount as rent expense. The companys fiscal year- end...
-
Show that every AVL tree can be colored as a red-black tree. Are all red-black trees AVL?
-
The government market is obviously an extremely large one, yet it is often slighted or even ignored by many firms. Red tape is certainly one reason, but there are others. Discuss the situ a tion and...
-
Write an essay as to how a limited liability company can raise the capital.
-
Joint Ventures are a common Mode of Entry in international business. Appreciate if in-depth elaboration provided on its advantages and disadvantages. Also briefly mention the factors which make joint...
-
The field excursion is intended to give students an opportunity to carry out an applied geographical research project based on observation, data recording, and analysis. Using a field site of your...
-
An angry coworker is expressing their needs through a rush of emotion and snide comments while another coworker is trying to interpret them to provide some help and support. You are a manager and...
-
You may have a general understanding of the difference between ethics and legality , but could you explain the distinction? It is not always easy to know where to draw the line between the two. Some...
-
Someone can be a good leader but not be a very good manager and vice-versa. Leadership is creating a vision for others to follow, establishing corporate values and ethics, and transforming the way...
-
A jar contains 13 red, 27 blue, and 20 green marbles. If a marble is drawn from the jar at random, find the probability that the marble is the following. (a) Blue (b) Not blue (c) Red
-
The Pletcher Transportation Company uses a responsibility reporting system to measure the performance of its three investment centers: Planes, Taxis, and Limos. Segment performance is measured using...
-
Compare the shadow-paging recovery scheme with the log-based recovery schemes in terms of ease of implementation and overhead cost.
-
Consider a database consisting of 10 consecutive disk blocks (block 1, block 2, . . ., block 10). Show the buffer state and a possible physical ordering of the blocks after the following updates,...
-
Explain how the buffer manager may cause the database to become inconsistent if some log records pertaining to a block are not output to stable storage before the block is output to disk.
-
Ventaz Corp manufactures small windows for back yard sheds. Historically, its demand has ranged from 30 to 50 windows per day with an average of 4646. Alex is one of the production workers and he...
-
Which of the following statements is not true regarding the $500 credit for dependent other than a qualifying child credit. Cannot be claimed on the same tax return if the child tax credit is also...
-
Grind Co. is considering replacing an existing machine. The new machine is expected to reduce labor costs by $127,000 per year for 5 years. Depreciation on the new machine is $57,000 compared with...
Study smarter with the SolutionInn App