Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer size #26

Open
zhihuidu opened this issue Feb 28, 2022 · 2 comments
Open

buffer size #26

zhihuidu opened this issue Feb 28, 2022 · 2 comments

Comments

@zhihuidu
Copy link

https://github.com/y-256/libdivsufsort/blob/master/lib/divsufsort.c#L105
If m=n/2, then the buffer size will be zero. How the B star substring can be sorted in a zero-size buffer?

@akamiru
Copy link

akamiru commented Feb 28, 2022

Note that m at this point (the code is really poor on naming) is the number of bstar suffixes. There can never be n/2 bstar suffixes therefore there will always be a buffer (that's the whole idea of the improve two stage algorithm).

I didn't dig deep enough to tell you why the buffer has to be n / (2 * m) tough.

@zhihuidu
Copy link
Author

@akamiru Thanks for your answer! Yes, m cannot be n/2. However, it can be very close to n/2 for some special cases.
I use
1212121212
as the input file and
n=11,m=5, bufsize =1.
then the bufsize is set to 2 (limit).
I have not got the reason why this will not overwrite the last m elements in SA .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants