SuffixArray.cpp
In this part of the assignment, we have provided a file called SuffixArray.cpp that contains initial steps towards implementing a Suffix Array. Function headers (with usage details) are included in SuffixArray.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 given string s of length n, you will likely be doing the following tasks:
string
s
n
Create a vector containing the integers 0, 1, ..., n–1
vector
Sort the vector such that, when you compare two integers i and j, instead of comparing their actual values, you compare the suffixes of s that start at indices i and j, respectively
i
j
For example, if s is NIEMA, if you are comparing the integers 1 and 2, 1 would be greater than 2 because the suffix of s starting at index 1 (IEMA) is alphabetically larger than the suffix of s starting at index 2 (EMA)
NIEMA
IEMA
EMA
Hint: You will want to define a custom comparison function that, when given two integers i and j, compares the suffixes of s starting at indices i and j. Refer to the C++ sort documentation to 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 called BWT.cpp that contains initial steps towards implementing the Burrows-Wheeler Transform. Function headers (with usage details) are included in BWT.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