4 января 2021
Kewl🪁Фотография
Sum of element of first array - sum of element of second array ...this should resolve it ..
ACPSum of element of first array - sum of element of second array ...this should resolve it ..
Wow!!! This is nice
Sum both and find their difference
Great!!
ACPThere will be lot of comparation if array becomes large ...
That's true
But both works using the same operators if you think about it
Benjamin FarunaThat's true
But both works using the same operators if you think about it
Of course all the solution provided in the chat will work ...
ACPThere will be lot of comparation if array becomes large ...
Yes, it comes with a price of increased complexity. The complexity is quadratic O(n2)
Omololu JumatYes, it comes with a price of increased complexity. The complexity is quadratic O(n2)
This is what I just went to look out for
Benjamin FarunaFor this I think if you consider how the sum operator works underneath you'll figure that both will turn out to have the same run time
No. I don't think they both have the same run time.
One is quadratic and the other is linear.
Omololu JumatConvert both arrays to sets. Then, find the difference between the two sets.
This is interesting 😂😂😂
Omololu JumatNo. I don't think they both have the same run time.
One is quadratic and the other is linear.
Yea... I noticed that after I checked
Sorry, my bad
I didn't consider the in operation being nested with the for operation
ACPI guess converting a array into set should be taking linear time ? Any idea guys
Yes, it does. Since it involves copying each element into the set(linear complexity) using hash function(constant complexity)
Benjamin FarunaYea... I noticed that after I checked
Sorry, my bad
I didn't consider the in operation being nested with the for operation
No problem, it could happen to anyone
Benjamin FarunaHash function?
You know, sets enforce uniqueness of their contents. Therefore, each element has to be assign different hash code. For example, say, a set already has 1 assigned a hash code abCgh(I fabricated this), the set will not take in another 1 because it will silently ignore the copy operation when it finds out that 1 already exists in the set.
This uniqueness is implemented by some languages behind the scene using hash function.
Omololu JumatYou know, sets enforce uniqueness of their contents. Therefore, each element has to be assign different hash code. For example, say, a set already has 1 assigned a hash code abCgh(I fabricated this), the set will not take in another 1 because it will silently ignore the copy operation when it finds
In short dictionary in python
Omololu JumatYou know, sets enforce uniqueness of their contents. Therefore, each element has to be assign different hash code. For example, say, a set already has 1 assigned a hash code abCgh(I fabricated this), the set will not take in another 1 because it will silently ignore the copy operation when it finds
Okay I understand what you mean now
The hash function is what makes every element in a set unique and repetition is not allowed
Omololu JumatI think he is referring to their similarity in terms of uniqueness of content
I didn't get that at first
Thanks alot
ACPI'm saying hashing and dictionary is same thing ....
In fact, I think another name for dictionary is hash in Python
Omololu JumatIn fact, I think another name for dictionary is hash in Python
Yeah ..lang to lang only name get changed behind the scene they work in similar fashion..