'What is the worst-case time complexity of reflect.DeepEqual() in Go?
I tried to analyze the source code, but many other functions are called from within deepValueEqual(), and I must admit that the use of recursion is throwing me off in this case.
Is there any official documentation of the function's worst-case running time?
*Edit: I don't quite understand how I would define input sizes in this case with two interface{} type arguments and it's adding to my confusion. Perhaps this is due to my unfamiliarity with time complexity.
Solution 1:[1]
What is the worst-case time complexity of reflect.DeepEqual() in Go?
O(n).
Note that your question doesn't make much sense formally. "time complexity" is a function of "input size" and how you measure "input size" is not well defined. reflect.DeepEqual takes just one argument so its time complexity is O(1) simply because you cannot apply this function to more than one argument. How you measure the size of one argument you didn't tell.
Is there any official documentation of the function's worst-case running time?
No.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Volker |
