Skip to content
Advertisement

Tag: big-o

Kotlin single equal sign “=” object assignment time complexity

What is the time complexity of object assignment using the equals sign in Kotlin (or Java)? More specifically if I have my own object ListNode What would be the copy time below? I find myself often doing this assignment since ListNode passes as val, and I can’t do Answer The assignment does not make a new ListNode object that contains

Big O – O(log(n)) code example

Like the Big O notation “O(1)” can describe following code: What code can O(log(n)) describe? Another question: What solutions are there for “Big O problems” (what to do, when getting a lot of data as an input)? Answer Classic example: This will be: 2k = x → Applying log to both sides → k = log(x)

Advertisement