TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Is it necessary to know algo and ds to be a good programmer

2 点作者 yolapa超过 9 年前
Hi,<p>I am of the opinion that programming has the potential to solve a lot of problems that humans are currently facing. But I have heard people saying that to be a good programmer you need to have algorithms and data structures at your tips. Do you think learning algos will help me solve problems in a better way?

2 条评论

davismwfl超过 9 年前
Yes. Not that you will know every algorithm, but you should know most data structures and at least the common algorithms.<p>One of the biggest weaknesses I consistently see is a lack of data structure and algorithm knowledge in developers. Here is why it separates you from the pack IMO. If you have the knowledge, you will not waste time selecting data structures that won&#x27;t work for the use case long term. This doesn&#x27;t mean you you will always be perfect, but you&#x27;ll understand the tradeoffs during design and not have to implement it only to find out it won&#x27;t really work. Algorithm knowledge goes hand in hand with data structures. If you know you have requirements to produce certain types of results you will change how you store data and which algorithms you use to search, sort and query it.<p>A lot of things I fix in other people&#x27;s code is poor choices in data structures and algorithms. I did one a few years back which took a process that ran for about 8 hours to complete and made it run in less than 5 minutes. It was relatively simple, essentially they were trying to use really poor data structures for the type of data and calculations they needed to do and they kept trying to work within those. For my implementation, I modified the data structures and used more appropriate algorithms to accomplish the same thing in what was almost instant to them. Yes, I consumed more memory on application boxes, but it was considerably less strain on the database and network.
WorldMaker超过 9 年前
Yes, absolutely. Good algorithms books show you strong patterns for how you can attack problems and program solutions. They will also often introduce you to some of the best, well-known algorithms that exist: these are known solutions that have been studied and examined. It&#x27;s amazing how often you may find that knowing a problem has a well-known solution allows you to &quot;skip ahead&quot; to the next, actual problem.<p>More importantly, data structures are essential to just about everything you do as a programmer. Every program has some amount of data it needs to utilize as input or output and data structures inform everything from where and how you store it to how you work it (how you program against it!).<p>Here you see the crossover back to algorithms and further the importance of good fundamentals in algorithms: well-known data structures have well-studied algorithms for things such as creation, insertion, deletion, management, sorting, iteration, and more. Better knowing those algorithms helps you better understand the tradeoffs between data structures.<p>Using the right data structure with the right set of algorithms for that data structure for the given usage cases of your data is a huge part of programming and a big distinction between bad programs, good programs, and amazing programs.