Questions tagged [python]
Programming questions are off-topic here. Do not ask questions about how to write code in Python. However, conceptual questions about computer science are more appropriate. See our help center for the scope of this site.
226 questions
0
votes
0
answers
43
views
Lambda calculus with keyword parameters?
Several programming languages support a calling convention wherein values are bound to parameters via a keyword, rather than position in a tuple of arguments. I'm curious whether there is any formal ...
1
vote
1
answer
73
views
Large-Scale Image Near-Duplicate Detection for Real Estate Dataset
I want to perform large-scale image similarities detection.
For context, I have a large database containing almost 13,000,000 flats. Every time a new flat is added to the database, I need to check ...
2
votes
0
answers
125
views
The problem of reachability in a directed graph, but all predecessors must be reached to reach a node
Let $S$ be a set of nodes belonging to a directed graph $G = (V,E)$. A vertex $v$ of $G$ is said to be reachable from $S$ if and only if $v \in S$, or if each predecessor of $v$ is reachable from $S$ ...
0
votes
1
answer
90
views
Flipping a single bit of Floating-points (IEEE-754) mathematically
I'm working on implementing a mathematical approach to bit flipping in IEEE 754 FP16 floating-point numbers without using direct bit manipulation. The goal is to flip a specific bit (particularly in ...
0
votes
2
answers
133
views
What other ways could be of representing an irreducible fraction without gcd?
My code for it:
from math import gcd
y = int(input())
w = int(input())
g = gcd(y, w)
print(f"{y// g}/{w// g}")
Could there be any other way of solving this problem without using gcd ?
1
vote
2
answers
196
views
How to select numbers with the same Hamming distance under certain conditions?
How can I find a non-exhaustive algorithm for the following problem?
In the $N$-base number system, there are exactly $ N^{(N+1)} $ numbers with $N+1$ digits.
I would like to select $N^2$ numbers such ...
-4
votes
1
answer
111
views
How to write the Python Program for the following condition?
How to write a Python Program for the following condition:
Let me explain how I tried to write the code.
$a=$ int$($input$($'enter the first integer between $1$ and $9$'$))$
$b=$ int$($input$($'enter ...
0
votes
1
answer
80
views
Why doesn't this recursive Fibonacci function in Python give me a recursion depth error?
I have the following Python (3.12) code for finding Fibonacci numbers recursively, and keeping track of how many times the function is called.
...
1
vote
1
answer
106
views
For which languages can branching be determined by static analysis?
Python has methods like getattr() which can be used to branch arbitrarily at runtime. As a result, static code analysis tools can't be certain what functions a ...
1
vote
1
answer
92
views
Do edge lists have O(E) storage if default values are used for absent keys?
Ordinarily, edge list representations of graphs take $O(V+E)$ space, where $V$ is the number of vertices and $E$ is the number of edges. For example, consider a graph with 5 nodes and a single edge ...
1
vote
3
answers
395
views
When do we multiply or add the time complexities of loops?
I am confused about calculating the time complexity of the following function.
...
1
vote
1
answer
172
views
Using XOR operation, a MOD operation compute a function f(n)
I had a difficult assignment in my Data Structures and Algorithms class.
We need to implement a program that computes a function f(n) based on the following known values of n and f(n):
n : 9689 ...
0
votes
1
answer
153
views
Improve performances of Gauss-Jordan (XOR-SAT) Algorithm?
In this question I was looking for an algorithm to solve what seems to be a XOR-SAT problem.
Let's consider this equation system :
...
0
votes
1
answer
127
views
Write an algorithm for finding the duplicated grades
I have an interesting real world problem. My brother is currently in school. The teachers perform the following procedure when giving him his grades. They take his list of grades ...
1
vote
1
answer
93
views
Generate product description from product specifications
I am looking for a python NLP library that can generate a proper product description based on product features provided to it.
Till now, i have tried transformers library and this is the code:
...