algorithm - What problems can be solved, or tackled more easily, using graphs and trees?

algorithm - What problems can be solved, or tackled more easily, using graphs and trees?

What are the most common problems that can be solved with both these data structures? It would be good for me to have also recommendations on books that: Implement the structures Implement and expla…


c++ - When to use STL bitsets instead of separate variables?

In what situation would it be more appropriate for me to use a bitset(STL container) to manage a set of flags rather than having them declared as a number of separate(bool) variables? Will I get a…



arrays - How would you implement a hashtable in language x?

The point of this question is to collect a list of examples of hashtable implementations using arrays in different languages. It would also be nice if someone could throw in a pretty detailed overview…


c++ - Regular cast vs. static_cast vs. dynamic_cast

This question already has an answer here: When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used? 8 answers I've been writing C and C++ code for almost twenty years, but there'…


c++ - What are some 'good use' examples of dynamic casting?

We often hear/read that one should avoid dynamic casting. I was wondering what would be 'good use' examples of it, according to you? Edit: Yes, I'm aware of that other thread: it is indeed when readi…


Does anyone have a good Proper Case algorithm

Does anyone have a trusted Proper Case or PCase algorithm(similar to a UCase or Upper)? I'm looking for something that takes a value such as "GEORGE BURDELL" or "george burdell" and turns it into "…


multithreading - What is a race condition?

When writing multi-threaded applications, one of the most common problems experienced are race conditions. My questions to the community are: What is a race condition? How do you detect them? How do…


c++ - Why can't a forward declaration be used for a std::vector?

If I create a class like so:// B.h#ifndef_B_H_#define_B_H_ class B{private: int x; int y;};#endif//_B_H_ and use it like this:// main.cpp#include<iostream>#include<vector>…


Can I have polymorphic containers with value semantics in C++?

As a general rule, I prefer using value rather than pointer semantics in C++(ie using vector<Class> instead of vector<Class*>). Usually the slight loss in performance is more than made up for by not…


c++ - How to wrap a function with variable length arguments?

I am looking to do this in C/C++. I came across Variable Length Arguments but this suggests a solution with Python & C using libffi. Now, if I want to wrap printf function with myprintf What I do is…




java example and how python with pdf array class tutorial