Suffix trees and suffix arrays in primary and secondary storage