You are viewing a single comment's thread. Return to all comments →
Hashmap implementation in Python In the worst case it will have an On complexity
def has_cycle(head): hashmap = dict() while head: hashmap[head] = hashmap.get(head, 0) + 1 if hashmap[head] > 1: return 1 head = head.next return 0
Seems like cookies are disabled on this browser, please enable them to open this website
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
Hashmap implementation in Python In the worst case it will have an On complexity