From 307e4e67c253de7e558809a710aa6a2918c8fe57 Mon Sep 17 00:00:00 2001 From: VARUN12KUMAR Date: Wed, 16 Oct 2019 16:37:21 +0530 Subject: [PATCH] add file --- Suffix tree/suffix _tree_impl.cpp | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Suffix tree/suffix _tree_impl.cpp diff --git a/Suffix tree/suffix _tree_impl.cpp b/Suffix tree/suffix _tree_impl.cpp new file mode 100644 index 0000000..0f800f8 --- /dev/null +++ b/Suffix tree/suffix _tree_impl.cpp @@ -0,0 +1,40 @@ +#include +#include + +using namespace std; +using namespace sdsl; + +typedef cst_sct3<> cst_t; +typedef cst_t::char_type char_type; + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + cout << "Usage: "<< argv[0] << " file" << endl; + cout << "(1) Generates the CST of file." << endl; + cout << "(2) Calculates the avg LCP value and the runs in the BWT." << endl; + return 1; + } + cst_t cst; + construct(cst, argv[1], 1); + + long double runs = 1; + long double avg_lcp = 0; + if (cst.csa.size()) { + char_type prev_bwt = cst.csa.bwt[0]; + for (uint64_t i=1; i