We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
it's not about computer architecture or compilers at all
This is false. Both things significantly clarify what your algorithm is actually doing on the machine it is running on. It is equivalent to defining the model of computation that goes with your complexity measure. Some computations require more resources on some models of computation and fewer on others.
not-nullifying-by-default language
This property is enforced by the behavior of the C# compiler you are using. The fact that there is some gentleman's agreement to write all C# compilers the same way is irrelevant. Not all languages are lucky enough to have this. Some special architecture out there might allow you to zero out memory in constant time. A C# compiler could be modified to take advantage of this, which would allow your algorithm to truly be O(n) instead of O(n+k) without any edits.
I'd like to see a book that is not like that.
The interview prep materials I've seen are, indeed, all very hand wavey and superficial. I stand by my suggestion. Having additional knowledge of how your code works under the hood (i.e. what choices compilers make and how computation is done on your processor) will tell you exactly how complex (resource-wise) each operation is. I'm not aware of an alternative approach to get at what you want that does a better job of this.
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
it's not about computer architecture or compilers at all
This is false. Both things significantly clarify what your algorithm is actually doing on the machine it is running on. It is equivalent to defining the model of computation that goes with your complexity measure. Some computations require more resources on some models of computation and fewer on others.
not-nullifying-by-default language
This property is enforced by the behavior of the C# compiler you are using. The fact that there is some gentleman's agreement to write all C# compilers the same way is irrelevant. Not all languages are lucky enough to have this. Some special architecture out there might allow you to zero out memory in constant time. A C# compiler could be modified to take advantage of this, which would allow your algorithm to truly be O(n) instead of O(n+k) without any edits.
I'd like to see a book that is not like that.
The interview prep materials I've seen are, indeed, all very hand wavey and superficial. I stand by my suggestion. Having additional knowledge of how your code works under the hood (i.e. what choices compilers make and how computation is done on your processor) will tell you exactly how complex (resource-wise) each operation is. I'm not aware of an alternative approach to get at what you want that does a better job of this.