121,490 questions
1
vote
1
answer
81
views
Fast vectorized maximal independent set greedy algorithm [closed]
I need a really fast vectorized maximal independent set algorithm implemented in pytorch, so I can use it for tasks with thousands of nodes in reasonable time.
I cannot use networkx, it is way too ...
-2
votes
1
answer
100
views
Arabic Word Normalization and Search Ignoring Prefixes and Suffixes in quran app [closed]
I’m developing a Qur’an search application that allows users to search for Arabic words and find their occurrences across the Qur’an.
To improve accuracy, I added a feature that removes Arabic ...
-6
votes
1
answer
78
views
Pseudocode for choosing the closest elevator (up or down) [closed]
There are two elevators — one is going up, and the other is going down.
When a person calls an elevator from any floor, the closest and most suitable elevator should come.
I want to design a ...
2
votes
3
answers
147
views
Swapping corresponding negative and positive elements in an array while keeping constant order in their respective groups
The problem:
Given an array in which the number of negative elements is equal to the number of positive elements (arranged in arbitrary order). Swap the first negative and the first positive, then ...
-3
votes
0
answers
119
views
How can I implement a linked list of integers in Java using contiguous memory? [closed]
I had a challenge in my class that I really don´t know how to solve it.
I want to implement a linked list of integers in Java, but I’d like all data to be stored in contiguous memory (like inside ...
0
votes
1
answer
82
views
Why is the worst-case binary selection sort time complexity considered O(n^2)?
Wikipedia and other textbooks reference binary selection sort's asymptotic worst-case time complexity to be O(n^2), usually justifying this with any extra computation caused by swaps. I don't ...
-2
votes
1
answer
96
views
The threeSumClosest algorithm does not return the expected closest sum [closed]
I'm solving the 3Sum Closest problem in LeetCode, where I need to find the sum of three numbers in a list that is as close as possible to a target value, in this case, target.
This is my code:
class ...
6
votes
3
answers
209
views
Swapping two array elements with two other specific array elements without using an if-statement
I have an array x of n >= 4 elements, at indices 0..n-1. I want to swap the elements at indices j and k, where 0 <= k < j < n with the elements at indices 0 and 1 (it doesn't matter ...
-3
votes
1
answer
83
views
How does Google Fonts browser optimize their font preview experience? [closed]
Analysis of Google Fonts
Here is me scrolling through the Greek fonts
As you scroll, you'll see it progressively calls the css2 url like:
https://fonts.googleapis.com/css2?family=STIX%20Two%20Text%...
1
vote
0
answers
47
views
Question regarding branch and bound algorithm for finding critical DFA's [closed]
I was reading this paper(page 5 and 6) which finds critical dfa's (dfa's with shortest synchronising word with length exactly exactly equal to (n-1)^2) for n <= 7.
https://arxiv.org/pdf/1801.10436
...
2
votes
1
answer
93
views
Calculating a light volume that comes in through a window
I have a room that is a box. There is a single rectangular window on one of the walls of the room. A directional light source is shining into the room through the window. The light source has a ...
-2
votes
1
answer
136
views
I need a Python implementation of my Longest Possible Common Subsequence (LPCS) algorithm [closed]
Please be merciful - I've never asked a question here (I've answered a few) and am a total Python noob.
I developed an algorithm in SQL Server to compute the Longest Possible Common Subsequence (LPCS) ...
4
votes
3
answers
186
views
Efficient ways to check if two binary trees are the same
I implemented a recursive solution in Python to check if two binary trees are identical, which traverses nodes recursively and compares values and structure. The time complexity is O(n), space O(h).
...
7
votes
1
answer
212
views
Does std::find still guarantee first element with std::execution::par?
Parallel policy states that order of iterator evaluation is not guaranteed. However, std::find*, std::search and std::mismatch all say that they return first iterator matching condition. How do those ...
3
votes
2
answers
287
views
Find employees with overlapping wortktime hours
Given StartTime and endTime for N employees, an employee can form a team if his working hour overlaps with other employees' (both startTime and endTime inclusive).
Find the maximum team size.
Example:
...