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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Next permutation: When C++ gets it right

58 点作者 r11t超过 15 年前

4 条评论

chadaustin超过 15 年前
Back when I competed regularly in TopCoder for food money in college, std::next_permutation saved my bacon. I got so good at whipping out &#60;algorithm&#62; in C++ that every other language's standard library felt deficient. Python's basically caught up with itertools and the built-in set type.<p>Often you can replace dozens of lines of for loops and if statements with set subtraction and some generator comprehensions. Sometimes the code ends up faster, to boot!
评论 #971754 未加载
rbranson超过 15 年前
This is one of the most truly balanced, well-written, pragmatic articles I've read on HN. Instead of the typical dogmatic spew that is nearly epidemic in blog posts, it reads more like a scientific paper, but without all the dryness.
评论 #971771 未加载
评论 #971552 未加载
wglb超过 15 年前
Very good tutorial on one of the recent Code Jam problems. The solution does at first seem mysterious, but the article does show how it works nicely.<p>Browsing through some of the solutions to the code jam, c++ seems frequently used. It is also sort of amusing to see how many participants apparently have a stock set of utility code. There is a lot of use of the STL to do things just as the article mentions.<p>The inventor of STL did have some fairly scathing words to say about OO programming.<p>Also, speed does sometimes matter, as occasionally the large data sets do require a bit of computational power, and you are under a time limit.
评论 #972170 未加载
DanielBMarkham超过 15 年前
Nicely done. Interesting (but true) jab at FP towards the end. Sometimes C++ is still the best tool for the job.
评论 #971597 未加载