File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 934934 " else:\n " ,
935935 " maximums.sort(reverse=True) # O(k log k)\n " ,
936936 " if n > maximums[-1]: # the minimum\n " ,
937- " maximums.pop() # O(k )\n " ,
938- " maximums.append(n) # O(k )\n " ,
937+ " maximums.pop() # O(1 )\n " ,
938+ " maximums.append(n) # O(1 )\n " ,
939939 " return maximums\n " ,
940940 " \n " ,
941941 " find_maximums(\" lots-of-numbers.txt\" , 3)"
945945 "cell_type" : " markdown" ,
946946 "metadata" : {},
947947 "source" : [
948- " - Each loop is $\\ mathcal{O}(k \\ log k) + \\ mathcal{O}(2k ) = \\ mathcal{O}(k \\ log k)$\n " ,
948+ " - Each loop is $\\ mathcal{O}(k \\ log k) + \\ mathcal{O}(2 ) = \\ mathcal{O}(k \\ log k)$\n " ,
949949 " - Total complexity: $\\ mathcal{O}(k \\ log k) \\ times n = \\ mathcal{O}(k \\ log k \\ times n)$"
950950 ]
951951 },
You can’t perform that action at this time.
0 commit comments