Summary
Using the techniques of “specification and transformation by parts”, algorithms are derived for the longest upsequence problem. First Dijkstra's algorithm and then two new modified merge algorithms are derived and presented in detail. The merge algorithms take advantage of natural runs in the input sequence and have a worst caseO(n logn) time complexity when appropriate merging techniques are used, but can be linear if long runs are present in the sequence. The first merge algorithm is logically equivalent to Dijkstra's algorithm; the second algorithm is based on the first one but uses a different merging technique. Expository remarks describe related results which evolved out of our work in programming by transformation; in particular, parallels are drawn between algorithms for the longest upsequence problem and algorithms for sorting.
Similar content being viewed by others
References
Dijkstra, E.W.: Some beautiful arguments using mathematical induction. Acta Informat.13, 1–8 (1980)
Dewar, R.B.K., Merritt, S.M.: A derivation of sorting algorithms (to be published)
Dewar, R.B.K., Schonberg, E.: The elements ofSETL style. Proc. ACM Conf., Detroit 1979
Dewar, R.B.K., Schonberg, E., Schwartz, J.T.: Higher level programming. CIMS, New York University 1981
Green, C., Barstow, D.R.: On program synthesis knowledge. Artifical Intelligence10, 241–279 (1978
Hwang, F.K., Lin, S.: A simple algorithm for merging two disjoint linearly ordered sets. SIAM J. Computing1, 31–39 1972
Knuth, D.E.: The art of computer programming, Vol. III: Sorting and searching. Addison-Wesley, Reading, MA, USA, 1973
Manacher, G.K.: Significant improvements to the Hwang-Lin merging algorithm. JACM26, 3, 434–440 (1979)
Manacher, G.K.: The Ford Johnson Sorting Algorithm is not optimal. JACM26, 3, 441–456 (1979)
Merritt, S.M.: The role of the high level specification in programming by transformation: Specification and transformation by parts. Ph.D. Thesis, Computer Science Dept. New York University, 1982
Schwartz, J.T.: On programming: An interim report on theSETL project. CIMS, New York University, 1974
Sharir, M.: Some observations concerning formal differentiation of set-theoretic expressions. ACM TOPLAS4, 2, 196–225 (1982)
Author information
Authors and Affiliations
Additional information
Work on this paper has been supported in part by: ONR Grant N00014-75-C-0571; NSF Grant MCS-80-04349; USDOE Contract EY-76-C-02-3077
Rights and permissions
About this article
Cite this article
Dewar, R.B.K., Merritt, S.M. & Sharir, M. Some modified algorithms for Dijkstra's longest upsequence problem. Acta Informatica 18, 1–15 (1982). https://doi.org/10.1007/BF00625277
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00625277