mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-02 06:46:18 -04:00
Add some cool queue, stacks, strings, math, bit manipulation examples (#35)
This commit is contained in:
parent
f3ee2cdf52
commit
0f455a0322
24 changed files with 932 additions and 13 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
__author__ = "bt3"
|
||||
|
||||
def binary_serch_counting(lst1, k, lo=0, hi=None):
|
||||
def binary_search_counting(lst1, k, lo=0, hi=None):
|
||||
if hi is None: hi = len(lst1)
|
||||
while lo < hi:
|
||||
mid = (lo+hi)//2
|
||||
|
@ -24,7 +24,7 @@ def find_time_occurrence_list(seq, k):
|
|||
the dict is fixed. Another way, since the array is sorted, it to
|
||||
use binary search, since this is only O(logn).
|
||||
"""
|
||||
index_some_k = binary_serch_counting(seq, k)
|
||||
index_some_k = binary_search_counting(seq, k)
|
||||
count = 1
|
||||
sizet = len(seq)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue