Skip to main content

All Questions

Tagged with
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 ...
Jnuk's user avatar
  • 33
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 ...
Loki Astari's user avatar
  • 95.4k
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 ...
StoneThrow's user avatar
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 ...
Filippo Bistaffa's user avatar
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 ...
James's user avatar
  • 41
5 votes
2 answers
664 views

Recursively calculating powers by squaring

Consider the following function that implements optimised O(log n) exponentiation by squaring: ...
saxbophone's user avatar
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 ...
CafféSospeso's user avatar
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 ...
Richard Robinson's user avatar
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. ...
ludicrous's user avatar
  • 109
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 ...
paigelarry342's user avatar
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: ...
DivijM's user avatar
  • 11
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: ...
coderodde's user avatar
  • 28.9k
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: ...
Emma's user avatar
  • 3,527
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 <...
Emma's user avatar
  • 3,527
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?...
nrw2000's user avatar
  • 43

15 30 50 per page
1
2 3 4 5 6