-
Notifications
You must be signed in to change notification settings - Fork 1
/
complexity.txt
48 lines (37 loc) · 2.12 KB
/
complexity.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
usedGridWords :: #wordsUsed
allGridWords :: O(showGrid) * gridSize
:: #wordsUsed * wordLength * gridSize^3
:: #wordsUsed * wordLength * #letters
insertWord :: O(letters)
:: wordLength^2 * #wordsUsed
singletonGrid :: 1
letterAt :: #wordsUsed * wordLength
:: #letters
letters :: length * O(letterAt)
:: wordLength^2 * #wordsUsed
bbox :: gridSize
:: #letters
showGrid :: O(letterAt) * gridSize^2
:: #wordsUsed * wordLength * gridSize^2
:: #wordsUsed * wordLength * #letters^2
reachableLetters :: O(freeDirs) * len(filledPositions) + O(filledPositions)
:: O(freeDirs) * gridSize^2 + gridSize^2 * O(letterAt)
:: O(letterAt) * gridSize^2 + gridSize^2 * #wordsUsed * wordLength
:: #wordsUsed * wordLength * gridSize^2
:: #wordsUsed * wordLength * #letters
allWordsValid :: wordListSize * O(allGridWords)
:: wordListSize * #wordsUsed * wordLength * gridSize^3
:: wordListSize * #wordsUsed * wordLength * #letters^3
longestFormableWords :: O(sort)(wordListSize)
:: wordListSize * log(wordListSize) (Wikipedia lists most sorts as O(n log n))
solveGrid :: initialWordListSize * log(initialWordListSize) + O(solveGridStage)
:: O(solveGridStage)
:: #letters / wordLength * O(reachableLetters) * O(extendUsingLetter)
:: #letters^2 / wordLength * #wordsUsed * wordLength * O(extendUsingLetter)
:: #letters^2 * #wordsUsed * O(extendUsingWordAt) * O(longestFormableWords)
:: #letters^2 * #wordsUsed * O(extendUsingWordAt) * wordListSize * log(wordListSize)
:: #letters^2 * #wordsUsed * wordLength^2 * O(tryInsertWord) * wordListSize * log(wordListSize)
:: #letters^2 * #wordsUsed * wordLength^4 * O(letters) * O(insertWord) * wordListSize * log(wordListSize)
:: #letters^2 * #wordsUsed^2 * wordLength^7 * wordListSize * log(wordListSize)
:: #letters^3 * #wordsUsed^2 * wordLength^7 * wordListSize * log(wordListSize)
:: #letters^5 * wordLength^5 * wordListSize * log(wordListSize)