1,799 questions
1
vote
2
answers
70
views
Class reduction in OOP (as opposite to extension). Is it exists?
Usually in OOP we create class hierarchies
class A{ //base class consists of field and method
int a;
void methodA(){}
}
class B extends A{ //derived class extends base class
int b; //additional field
...
6
votes
0
answers
67
views
Leader Election: A question about Peterson's Improved Algorithm for Unidirectional Ring
This question refers to Peterson’s improved election algorithm for unidirectional ring:
tid := initial value
do forever
begin
send(tid) /* Compare to the left */
...
0
votes
1
answer
155
views
Is there such a thing as a non-copiable type in Haskell?
In short, I'm trying to understand why copying, which is such a fundamental thing in C++ (fundamental in the sense that you, as the programmer, have quite a lot of power in writing code to permit or ...
0
votes
1
answer
45
views
Neo4j - Count of symmetric meta-path - Include half meta-paths
I have constructed a Neo4j graph based on MovieLens100k with the following content:
Nodes: (:User), (:Movie), (:Genre)
Relations: (:User)-[:RATED]->(:Movie), (:Movie)-[:HAS_GENRE]->(:Genre)
I ...
6
votes
1
answer
115
views
What is the most efficient algorithm for merging sorted lists with a carry-forward mechanism for missing keys?
I'm working with multiple ordered lists, each containing tuples of the form (key, value), where each list is sorted in ascending order by key. I want to merge these lists into a single ordered list ...
2
votes
0
answers
112
views
Finding the minimum cost at each point in time from a set of weighted intervals
Let’s say we have a list of intervals, each of which has a cost associated with it. Assume that there is always at least one interval active.
The solution would be a timeline of non overlapping ...
1
vote
2
answers
184
views
In C++, is the overloading of the arrow operator an exceptional case or does it follow the same logic as the case for other operators?
I have a question regarding the arrow operator's overload process. The overloading makes it seem like it is a unary operator, while the usage makes it appear as a binary operator. The return value isn'...
0
votes
1
answer
108
views
Theorem for lambda calculus
I have to solve this exercise:
Formulate and prove a confluence theorem for lambda calculus (ie, prove that if a λ-expression e reduces to both e1 and e2, then there exists e' such that e1 and e2 ...
3
votes
2
answers
144
views
std::string concatenation in C++
What is the principle of std::string concatenation in C++ ? How does it works in memory allocation ?
I found out while exploring a leetcode card that in Java:
"concatenation works by first ...
1
vote
2
answers
96
views
How to model a "in-a" relationship in the object oriented programming paradigm?
I am new to object oriented programming (been programming in imperative/data-oriented style), so please bear with me. As far as I understand, inheritance models the IS-A relationship, and member ...
1
vote
1
answer
85
views
Can an already compiled binary recompiled for another architecture?
Let's say we have an ARM binary and we want to run this in x86 device, underlying operating system (in this case it's Ubuntu) is same.
The idea in this case would be:
Disassemble the binary
Rewrite ...
-4
votes
1
answer
84
views
Performance of using map once vs. multiple times [closed]
For most of my development career, I was convinced that iterating over an array multiple times should be avoided.
After a lot of back and forth, I'm not so sure anymore, so I'd like to ask for your ...
3
votes
2
answers
115
views
Linear time algorithm for computing radius of membership hyper-sphere
We are given a Graph, G(V, E), where V is the node set and E is the edge set consisting of ordered tuples (u, v). The graph is undirected, as such, if (u,v) is in E, then (v, u) is in E.
Alongside the ...
0
votes
1
answer
122
views
Calculating Ranking on a large set of data(4000+) that changes depending on the date range selected and orderby
I have a large set of data, 4000 rows+. each row is associated with metric data that is collected daily. Metric table is at over 1.1 million rows.
for example:
Item table:
Id
Item
1
Hello
2
World
...
....
0
votes
0
answers
34
views
Vector representation through untrained fully connected layer
I have a vector as a list, x = [a1,a2,a3,...aN]. I pass it through a fully connected layer defined as this
dense = tf.keras.layers.Dense(units=8, kernel_initializer='glorot_uniform')
This fully ...