#n keys, and assume strongly connected
1 messages · Page 1 of 1 (latest)
assuming every node is connected to every other node
in that case ur adj list is kinda useless
yeah
bc in a matrix at least u can just check if the value is set
and that would be O(1)
assuming u initialized NxN grid
wait im confusing
time with space again sry
but yeah point still stands
yeah that makes sense
but in any case when you have a hashmap that has n keys and the value for each key could be an array up to n nodes, the Space would be n^2 right?
yeah
ty
n keys with n values each
hey, anoter quick question about space if that's okay. if I slice a string str[:i] but immediatley convert it to an int(str[i;]) is this adding to space complexity? if nothing else was stored, would the slice still result in a O(n) overall SC where n is len of str