SuffixArray.cpp
In this part of the assignment, we have provided a file calledSuffixArray.cppthat contains initial steps towards implementing a Suffix Array. Function headers (with usage details) are included inSuffixArray.h. Your task is to fill in the missing code.
SuffixArray.h
Remember that, in the naive algorithm to construct a Suffix Array from a givenstringsof lengthn, you will likely be doing the following tasks:
string
s
n
Create avectorcontaining the integers 0, 1, ...,n–1
vector
Sort thevectorsuch that, when you compare two integersiandj, instead of comparing their actual values, you compare the suffixes ofsthat start at indicesiandj, respectively
i
j
For example, ifsisNIEMA, if you are comparing the integers 1 and 2, 1 would be greater than 2 because the suffix ofsstarting at index 1 (IEMA) is alphabetically larger than the suffix ofsstarting at index 2 (EMA)
NIEMA
IEMA
EMA
Hint:You will want to define a custom comparison function that, when given two integersiandj, compares the suffixes ofsstarting at indicesiandj. Refer to theC++sortdocumentationto see an example of the syntax of defining and using a custom comparison function.
sort
BWT.cpp
In this part of the assignment, we have provided a file calledBWT.cppthat contains initial steps towards implementing the Burrows-Wheeler Transform. Function headers (with usage details) are included inBWT.h. Your task is to fill in the missing code.
BWT.h
Hint: The code you wrote to implement the Suffix Array in Part 2.2 can likely be adapted to implement the BWT in this challenge.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here