美文网首页
讲解:LIS、Python、dynamic program、Py

讲解:LIS、Python、dynamic program、Py

作者: xiaoaopou | 来源:发表于2020-01-12 16:22 被阅读0次

    Project 7: LISDue: Friday April 26, 11:59 pm1 Assignment OverviewFor this project you will implement a dynamic program that solves the longest increasing subsequenceproblem. A sequence S is a subsequence of another sequence T if you can produce S by removing someitems from T (without reordering them). For instance, [0, 2, 5] is a subsequence of [0, 1, 2, 3, 4, 5,], but [5,2, 0] is not. Your objective is to find the longest possible subsequence whose items are strictly increasing(that is if i 2 Assignment DeliverablesYou must turn in completed versions of the following files: Lis.pyBe sure to use the specified file name and to submit your files for grading via Mimir before the projectdeadline.3 Assignment SpecificationsYour task will be to complete the methods listed below: verify subseq: Determines whether one sequence is a subsequence of another. verify increasing: Determines whether a sequence is in increasing order. find lis: Finds the longest increasing subsequence of the given sequence.If multiple subsequences each have the maximum possible size you may return any of them.You may use any of the standard collections discussed in class as well as the built-in functions that actupon them. You may add any additional helper functions that you need.You may assume that each sequence contains mutually comparable items (they have a you cannot make other assumptions about their types. You are not allowed to modify the input sequence inany way. ThLIS留学生作业代做、Python编程设计作业调试、代写dynamic program作业、Python课程设计作业代写e sequence is indexable (but it might not be a list).Both of the verification methods should run in O(n) time and require only a constant amount of extraspace. While a O(n2) solution to the find lis method is readily apparent, your solution should takeO(n log n) time and require at most O(n) extra space.You should include comments where appropriate. In particular, you should describe the method usedfor computing the LIS. You must also add documentation for each of the above methods (as well as for anyhelper functions created).14 Assignment Notes Points will be deducted if your solution has warnings of any type. You have been supplied with stubs for the required methods. You must complete these methods tocomplete the project. You may add more functions than what was provided, but you may not modifythe signatures of the provided methods. You have been provided with some unit tests that can be used to assess your solution. There areadditional test cases that will be kept hidden. It is your responsibility to check for potential edge cases. The supplied unit tests do not account forall possible valid inputs You may use a wide variety of collections classes. You may want to use list, set, dict, heapq, deque,or defaultdict. The items in the subsequence must be strictly increasing. Equal items are not allowed. You may not modify the input sequence. Some of the tests give you a string (character sequence) instead of a list. You may still return a listrather than a string.2转自:http://www.7daixie.com/2019042853422667.html

    相关文章

      网友评论

          本文标题:讲解:LIS、Python、dynamic program、Py

          本文链接:https://www.haomeiwen.com/subject/alxwactx.html