Know Your Limits.

Know Your Limits.

Understanding your limitations is essential. As Dirty Harry famously said, "A man's got to know his limitations." This means acknowledging that your resources are finite, including your time, money, knowledge, skills, and tools. You can only work within your capacity, and you must respect the limits of your resources.

To respect these limits, you should know yourself, your team, your budgets, and your field of expertise. As a software engineer, you should also understand the space and time complexity of your algorithms and data structures, as well as the architecture and performance characteristics of your systems. Your goal is to achieve the optimal balance between software and systems.

Complexity analysis measures the abstract machine's performance, but software runs on real machines that are organized into hierarchies of physical and virtual machines. These systems vary in capacity and speed, and caching and lookahead are used to hide the variation. However, frequent cache misses can lead to thrashing. Accessing recently used items and accessing items sequentially are typically advantageous, while random access is unpredictable.

Algorithms and data structures differ in how effectively they utilize caches. Linear search makes good use of lookahead but requires O(n) comparisons, while binary search of a sorted array only requires O(log(n)) comparisons. The van Emde Boas tree search is O(log(n)) and cache-oblivious, making it the best choice for searching arrays of 64-bit integers. To select the optimal algorithm or data structure, you must measure its performance on your system. #ProgrammingLimitsAndComplexity




要查看或添加评论,请登录

Harshit Walia的更多文章

社区洞察

其他会员也浏览了