Down the Rabbit Hole: An Exploration of Stack Overflow Questions - Marshall Clow - CppCon 2021

Explore the rabbit hole of Stack Overflow questions, uncovering valuable lessons on problem-solving, algorithm efficiency, and the importance of benchmarking and testing.

Key takeaways
  • When stuck on a problem, try writing it down and walking away to clear your mind.
  • Don’t be afraid to try a different approach.
  • Consider partial sort for finding the second largest or smallest element in a sequence.
  • When comparing characters, consider the locale-specific ispunked function, but be aware of its limitations.
  • If you’re working with signed characters, be aware that negative numbers always come before positive numbers.
  • Swapping a large amount of data can be expensive, so consider the cost of swaps in your algorithm.
  • The standard library is not always the best choice for every problem, and custom algorithms can be more efficient.
  • Benchmarking and testing different approaches can help you determine the best solution.
  • When implementing an algorithm, consider the specific requirements and constraints of the problem.
  • The std::ispunked function can be locale-specific and may not always work as expected.
  • Custom algorithms can be more efficient than standard library functions in certain situations.
  • The partial_sort function can be useful for finding the top N elements in a sequence.
  • Writing down your thoughts and ideas can help you clarify your thinking and solve a problem.
  • The nth_element function can be used to find the nth smallest element in a sequence.
  • The equal_range function can be used to find a range of elements in a sequence that match a certain condition.
  • The std::cppreference.com website is a good resource for learning about the C++ standard library.
  • The libC++ library is a good resource for learning about the C++ standard library.