-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
21 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,7 @@ | |
*.code-workspace | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
.history/ | ||
|
||
# Python cache | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
22 changes: 12 additions & 10 deletions
22
...ing/ComparisonSortingComplexityLowerBound → .../ComparisonSortingComplexityLowerBound.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
Hvorfor er det en nedre grense for kompleksiteten til sammenligningsbaserte algoritmer? | ||
# Hvorfor er det en nedre grense for kompleksiteten til sammenligningsbaserte algoritmer? | ||
|
||
Forestill deg et sammenligningstre, slik som treet på side 192 i boka. Den maksimale høyden til dette treet er 3, | ||
og det er 6 løvnoder. Dette sammenligningstreet sammenligner tallene i en liste med 3 tall. | ||
Det er 3!=6 ulike permutasjoner av inputet, så det minste antallet løvnoder er 6. | ||
|
||
Så n = 3 | ||
h = 3 | ||
antall løvnoder = 6 | ||
Så n = 3 | ||
h = 3 | ||
antall løvnoder = 6 | ||
|
||
Det maksimale antallet løvnoder vi kan ha, er 2^h = 2^3 = 8 | ||
Det minste antallet løvnoder er n! = 6 | ||
|
||
Vi vil finne høyden til treet, fordi høyden gir oss antallet sammenligninger vi må gjøre for å sortere listen. | ||
(Hvert nivå er en sammenligning). | ||
Dette kan vi finne ved å løse | ||
2^h >= n! | ||
lg2^h >= lg(n!) | ||
h*lg2 >= n lg(n) | ||
h >= n lg(n) | ||
|
||
https://www.youtube.com/watch?v=WffUZk1pgXE&ab_channel=BackToBackSWE | ||
Dette kan vi finne ved å løse | ||
2^h >= n! | ||
lg2^h >= lg(n!) | ||
h*lg2 >= n lg(n) | ||
h >= n lg(n) | ||
|
||
<https://www.youtube.com/watch?v=WffUZk1pgXE&ab_channel=BackToBackSWE> |
This file was deleted.
Oops, something went wrong.