0

However its easy to get the implementation using C++ as there is built-in Sort() function in algorithm header file.
I have gone through the both naive method and O(nlogn) methods of forming the array. In both the cases the sort() function is used for sorting the suffixes.

Is there any good method in C?

Anthon
  • 69,918
  • 32
  • 186
  • 246
Kalu
  • 290
  • 2
  • 13
  • Have a look at the concept of [SSCCE](http://sscce.org/). Please provide an example with a simple input and the desired output. – Agostino Jun 08 '15 at 19:30

1 Answers1

0

Are you saying you googled "sort c" and found NOTHING? I see several helpful links when I do that. For example, have a look at this question and its answers: C library function to do sort. Also the Wikipedia article on suffix arrays gives good overview of methods of constructing suffix arrays: O(N) method of constructing a suffix tree and then the suffix array, O(N^2 log N) method of sorting the suffixes (sorting requires O(N log N) comparisons, and each comparison is O(N), so the total time is O(N^2 log N)), and other advanced methods. The Wikipedia article also points to a few implementations in Java, C/C++ etc.

Community
  • 1
  • 1
Rishi
  • 121
  • 4
  • Maybe a suffix array is not a 1D vector, but rather a 2D matrix? That would require some specialized kind of sorting. – Agostino Jun 08 '15 at 19:28
  • 1
    Thanks @Agostino. I picked on only the point that they were able to use standard C++ Sort, but couldn't find a C equivalent. I could have added just a comment, but not enough reputation, so added an answer. Anyway, we can only wait for SSCCE. – Rishi Jun 08 '15 at 20:00