Write a function to find the length of the

longest common subsequencebetween two sequences.E.g. Given the strings “serendipitous” and “precipitation”, the longest common subsequence is “reipito” and its length is 7.

** Recursive approach** →

- Create two counters
`idx1`

and`idx2`

starting at 0. Our recursive function will compute the LCS of`seq1[idx1:]`

and`seq2[idx2:]`

- If
`seq1[idx1]`

and`seq2[idx2]`

are equal, then this character belongs to the LCS of`seq1[idx1:]`

and`seq2[idx2:]`

(why?). Further the length this is LCS is one more than LCS of`seq1[idx1+1:]`

and`seq2[idx2+1:]`

"Sorting" essentially refers to "sorting in ascending order", unless specified otherwise.

Sorting algorithms are capable of doing multiple and extraordinary things, imagine how much time it would take for a human to sort a list of thousands of names to make a phonebook, or a list of thousands of recipes, archives, animals, etc.

Let’s create a list of numbers to be sorted as an example !

`nums`

: A list of numbers e.g. `[4, 2, 6, 3, 4, 6, 2, 1]`

It is called by this name because herein smaller elements to *bubble* to the top and larger to *sink* to…

Wondering how to do that?! Well, then continue reading… :)

As it is well known that *Python Dictionaries *are a data structure which are used to store key-value pairs; where “keys” are used to store and retrieve the stored “values”. For example, here is a dictionary for storing and retrieving the marks of students in a class;

# Creating a dictionary

result =

{

'A' : '20',

'B' : '15',

'C' : '10'

}

result# Retrieving the marks using key value(here, name)

result['A']# Add a new value

result['Z'] = '9'# Update existing value

result['A'] = '11'#…

A linked list is a *data structure* used for storing a sequence of elements. It’s data with some structure (the sequence).

`class `**LinkedList**(): def __in**it__(sel**f): self.head = None def append(self, value): if s**elf.he**ad is None: self.head = Node(value) else: current_node = self.head while current_node.next is not None: current_node = current_node.next current_node.next = Node(value) def show_elements(self): current = self.head while current is not None: print(current.data) current = current.next def length(**self): result** = 0 current = self.head while current is not None: result += 1 current = current.next return result def get_element(self, position): i = 0 current = self.head** while** current is…

It’s called a “tree” because it vaguely resembles an inverted tree trunk with branches.

- The word “binary” indicates that each “node” in the tree can have at most 2 children (left or right).
- Nodes can have 0, 1 or 2 children. Nodes that do not have any children are sometimes also called “leaves”.
- The single node at the top is called the “root” node, and it typically where operations like search, insertion etc. begin.

Follow me on my #100DaysOfCode journey on Twitter → https://twitter.com/AditiDeodhar09