# A tutorial on Suffix Arrays

**URL:** <https://discuss.codechef.com/t/a-tutorial-on-suffix-arrays/2950>\
**Category:** tutorial\
**Tags:** array, construction, prefix-suffix, tutorial\
**Created:** [August 17, 2013, 5:33am UTC](https://discuss.codechef.com/t/a-tutorial-on-suffix-arrays/2950 "2013-08-17T05:33:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![saikrishna173](https://discuss.codechef.com/user_avatar/discuss.codechef.com/saikrishna173/32/208155_2.png) [@saikrishna173](https://discuss.codechef.com/u/saikrishna173)\
**Post date:** [September 9, 2013, 2:11am UTC](https://discuss.codechef.com/t/a-tutorial-on-suffix-arrays/2950/3 "2013-09-09T02:11:17Z")

</div>

Thanks a lot for the post…  
Now I understand the suffix array implementation clearly.

I think in the c++ implementation it should be

`for(stp=1, cnt = 1; cnt < N; stp++, cnt *= 2)`

instead of

```
for(stp=1, cnt = 1; cnt/2 < N; stp++, cnt /= 2)
```

---

_[View the full topic](https://discuss.codechef.com/t/a-tutorial-on-suffix-arrays/2950)._
