Computer Science

IT Matura Course | Algorithms #10


categories: computer science

Hello everyone,
Below you will find a video with a detailed explanation of the algorithm for finding the longest common subsequence. Its operation, time complexity, and usefulness. Below you will also find ready-made code to copy if needed.
Code:


tab = [5, 3, 8, 2, 5, 9, 65, 4, 3, 2, 65, 3, 23]

def sort(tablica):
    ile = [0] * (max(tab) + 1)
    
    for i in range(len(tablica)):
        ile[tablica[i]] += 1

    posortowanaTablica = []

    for j in range(len(ile)):
        while ile[j] > 0:
            ile[j] -= 1
            posortowanaTablica.append(j)

    return posortowanaTablica

print(sort(tab))
                  

Video:

Thank you for reading!


Read more
Administrator

This post was written by the administrator

Recent Posts

Proof Problems in Mathematics The Beginning Integrals, Course Practical Physics for Engineers IT Matura Course | Algorithms IT Matura Course | Databases IT Matura Course | Theory IT Matura Course | Spreadsheet

Archive

Year 2022

Comments