Intuitively, both algorithm 1, and algorithm 2 are linear time algorithms, which depends on the length of "common" subsequence, i.e., at most O(min(T, T')).
the overall time complexity of our method for computing a passage is O((T+T')(1+hlogm)+ min(T, T')).