3

First, a note on complexity. Both your implementation and the reference implementation do indeed have O(n) complexity in the number of input digits in the best case, but O(log(n)) in the range of the input number. This depends, mind you, on the expected range of the input number. For "typical values" below the limit of machine precision, which ...


1

Congratulations on the correct use of the C++11 condition variables! As mentioned by vnp, there will be no difference functionally or performance wise in this specific case, as there is only ever one thread waiting while the other notifies. Some possible improvements though: Unnecessary return statements You don't need a return statement at the end of a void ...


Only top voted, non community-wiki answers of a minimum length are eligible