Sorting su mxes : Let T be a string of characters T,T.…T 1. where T; denotes the i-th character (counting from 0) of T. A substring T..T-1,0

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
please use c program. thank you
Sorting suffixes :
Let T be a string of characters ToT.T,-1, where T; denotes the i-th character (counting from 0) of T .
A substring T..Tn-1,0 < i <n – 1, is called a suffix of T.
For example, for the string tgtgtgtgcaccg, its suffix starting at the 6th position is tgcaccg.
In fact, this string has 13 suffixes (because the length of the string is 13), and they are shown below along with their starting position in the string.
e:tgtgtgtgcaccg
1:gtgtgtgcaccg
2:tgtgtgcaccg
3:gtgtgcaccg
4:tgtgcaccg
5:gtgcaccg
6:tgcaccg
7:gcaccg
8:caccg
9:accg
10:ccg
11:cg
12:g
If we were to sort this set of suffixes in lexicographical order (the order you see in an English-language dictionary), we would get :
9:accg
8:caccg
10:ccg
11:cg
12:g
7:gcaccg
5:gtgcaccg
3:gtgtgcaccg
1:gtgtgtgcaccg
6:tgcaccg
4:tgtgcaccg
2:tgtgtgcaccg
0:tgtgtgtgcaccg
This list of sorted suffixes can be represented by an array containing just the starting positions (and not the suffixes themselves).
Such an array is called a suffix array.
For the example string above, its suffix array is:
98 10 11 12 75 3164 20
Choose one sorting algorithm from each of Groups 1 and 2 below. Brainstorm with your group members about how you would modify each of the 2 algorithms such that instead of
sorting numbers, it sorts all suffixes of a given string to produce the suffix array of the string.
Group 1: Insertion Sort
Group 2: Merge Sort
Transcribed Image Text:Sorting suffixes : Let T be a string of characters ToT.T,-1, where T; denotes the i-th character (counting from 0) of T . A substring T..Tn-1,0 < i <n – 1, is called a suffix of T. For example, for the string tgtgtgtgcaccg, its suffix starting at the 6th position is tgcaccg. In fact, this string has 13 suffixes (because the length of the string is 13), and they are shown below along with their starting position in the string. e:tgtgtgtgcaccg 1:gtgtgtgcaccg 2:tgtgtgcaccg 3:gtgtgcaccg 4:tgtgcaccg 5:gtgcaccg 6:tgcaccg 7:gcaccg 8:caccg 9:accg 10:ccg 11:cg 12:g If we were to sort this set of suffixes in lexicographical order (the order you see in an English-language dictionary), we would get : 9:accg 8:caccg 10:ccg 11:cg 12:g 7:gcaccg 5:gtgcaccg 3:gtgtgcaccg 1:gtgtgtgcaccg 6:tgcaccg 4:tgtgcaccg 2:tgtgtgcaccg 0:tgtgtgtgcaccg This list of sorted suffixes can be represented by an array containing just the starting positions (and not the suffixes themselves). Such an array is called a suffix array. For the example string above, its suffix array is: 98 10 11 12 75 3164 20 Choose one sorting algorithm from each of Groups 1 and 2 below. Brainstorm with your group members about how you would modify each of the 2 algorithms such that instead of sorting numbers, it sorts all suffixes of a given string to produce the suffix array of the string. Group 1: Insertion Sort Group 2: Merge Sort
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY