Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esercizio Lezione 10 - #1 #62

Open
luckignolo32 opened this issue May 9, 2024 · 2 comments
Open

Esercizio Lezione 10 - #1 #62

luckignolo32 opened this issue May 9, 2024 · 2 comments

Comments

@luckignolo32
Copy link
Member

image
@luckignolo32
Copy link
Member Author

Il primo:

def Lista20(A):
    B = []
    C = []
    for i in A:
        if I == 0: B.append(i)
        else: C.append(i)
    A = B + C

Praticamente scorre A, e se il valore è 0 lo mette in B, sennò in C. Poi trasforma A nella concatenazione di B e C. Scorre semplicemente la lista, quindi il costo è $\Theta(n)$.

@luckignolo32
Copy link
Member Author

luckignolo32 commented May 9, 2024

Il secondo:
Una lista ordinata ([0, 1, 2, 3, 4, 5, 6, 7]). Il perché sta nelle slide, non mi va di scrivere e poi c'è l'esercizio a parte.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant