Longest increasing subset Prolog

前端 未结 2 1322
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 03:40

I want to create in Prolog to find longest increasing subset of entered list. For example, you enter list of [3,1,2] and the output is [1,2],

?- subset([3,1,2],          


        
2条回答
  •  醉话见心
    2021-01-24 04:06

    Just out of curiosity, would it be possible in prolog to realize something like this for finding longest increasing subsequence:

    • You find all subsets of list
    • Than you find, which of these subsets are increasing
    • And then you search for the longest

    If it's possible, how could I do that in Prolog?

提交回复
热议问题