All Questions
Tagged with comparative-review c++
83
questions
3
votes
1
answer
92
views
Simple C++ event loop - static vs dynamic dispatch performance
I have two extremely simple toy implementations of an event loop, and would like to understand the performance differences between them.
First impl - events with a virtual 'handle' method - dynamic ...
2
votes
1
answer
46
views
Comparison of Named parameters and the Java Builder pattern in C++
OK writing a C++ wrapper on top of openSSL.
Setting up the SSL_CTX* object. There are a whole bunch of extra functions to specify functionality on how this object ...
2
votes
1
answer
117
views
Logger that can be redirected to switch off output
I am evaluating two implementations of a C++ logging mechanism.
The first implementation, below, unconditionally streams (calls the insertion operator) to the ...
7
votes
6
answers
1k
views
Compute "negative" version of vector of vectors
Given a std::vector<std::vector<double>> (e.g., representing some points in a space with D dimensions), I want to ...
2
votes
1
answer
161
views
C/C++ hash looking in flat database compared to PHP
I have a hash table which I would like to query as fast as possible.
The hash table is stored this way :
When I query a hash, I extract first 4 characters then use it to find the file. For instance a ...
5
votes
2
answers
664
views
Recursively calculating powers by squaring
Consider the following function that implements optimised O(log n) exponentiation by squaring:
...
3
votes
0
answers
1k
views
Return a 2D matrix from a C++ function in Python: ctypes versus pybind11
I found two ways in which I can use a custom C++ function (returning a 2D matrix) in Python. One approach that uses the Python module ctypes and another that uses the Python module pybind11.
Approach ...
0
votes
1
answer
95
views
Time complexity of several methods of reversing a domain name string
Note: I'm aware of this existing post which is similar. However, it does not address all my questions sufficiently.
I have the following three functions, all of which do the same thing: reverse a ...
0
votes
1
answer
71
views
2 ConvertToBase3 methods with great disparity of execution time
I have two methods to do the same thing: convert a number to ternary.
...
0
votes
2
answers
478
views
c++ Most clean way to implement duplicate Binary Search Tree for complex type
I have tried to make my own implementation for a BST task I was given for a complex type (Transaction), that should be able to store duplicate values as well.
However, I am not sure if I have gone ...
1
vote
2
answers
95
views
Comparison of 2 different ways of writing Merge Sort Algorithm
I have recently learned Merge Sort algorithm in C++ with 2 ways of writing it.
1st Way:
...
2
votes
1
answer
2k
views
C++: swapping bytes of an uint64_t
This question is about swapping bytes of an uint64_t value, or in other words, about converting between endianness of an integer value:
...
3
votes
1
answer
240
views
LeetCode 1115: Print FooBar Alternately
I'm posting two solutions for LeetCode's "Print FooBar Alternately". If you'd like to review, please do. Thank you!
Problem
Suppose you are given the following code:
...
1
vote
1
answer
255
views
LeetCode 863: All Nodes Distance K in Binary Tree
I'm posting two similar solutions for LeetCode's "All Nodes Distance K in Binary Tree". If you'd like to review, please do so. Thank you!
Problem
We are given a binary tree (with root node <...
4
votes
2
answers
72
views
An example of transferring the C ++ class hierarchy to Golang. Is it done correctly?
I am trying to transfer my c ++ experience to the Go area. I'm new to Go, so not sure if the implementation is correct. In any case, it looks very ugly compared to C ++ code. Is there a nicer solution?...