CAS CS 111 Lecture Notes - Lecture 13: Subsequence, Playstation 3, Gang Of Youths
CAS CS 111 verified notes
13/38View all
Document Summary
When designing a function, it often helps to write a separate helper function for a portion of the overall task. Returns the number of characters in s1 that are shared by s2. The positions and the order of the characters do not matter. Returns: a version of values in which all occurrences of elem in values (if any) are removed. Inputs: an arbitrary value (elem) and a list (values) Returns: a version of values in which only the first occurrence of elem in values (if any) is removed. What is our one step: what other changes are needed, subsequences. A string s1 is a subsequence of another string s2 if: All of s1"s characters appear in s2. All characters appear in the same order, but not necessarily adjacent to each other. The lcs of two strings is the longest subsequences that is common to both strings. both strings. Finding the lcs is useful when comparing two dna sequences.