Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
2 answers
39 views

I've been trying to teach myself various sort methods just for the sake of being able to use them in the future and right now I've been teaching myself about shell sorts. I understand the way shell ...
Neptunium-Eater's user avatar
0 votes
0 answers
45 views

I am working on a program that is supposed to build a tree using nested lists in Racket. I believe I am very close, but I am stuck on one section of my insertion testing process. The syntax for my ...
JoshLeonthe1st's user avatar
Advice
0 votes
3 replies
51 views

The context is implementing conversion functions between Gregorian calendar dates and Julian dates. Most (nearly all?) such implementations have restrictions on the dates - typically requiring that ...
John's user avatar
  • 1,673
0 votes
2 answers
78 views

I am trying to understand Wallace Trees. The algorithm goes multiply each bit of one number a by each bit of the other (b), which is accomplished as a simple AND gate, where the partial product of ...
yosmo78's user avatar
  • 641
2 votes
1 answer
158 views

The inverse of the gamma function over the reals is multivalued with an infinite number of branches. This self-answered question is about the principal inverse of the gamma function, Γ0-1(x), whose ...
njuffa's user avatar
  • 27.1k
-3 votes
1 answer
129 views

The algorithm I've written for an assignment is closely related to this monotonic stack approach https://www.geeksforgeeks.org/dsa/next-greater-element/ Best case: n pushes → Time complexity: O(n) ...
user29898's user avatar
2 votes
1 answer
151 views

Problem: We are given a list of integers of length n. What is the minimum number of elements whose sign you need to flip such that every prefix sum is non-negative? (A prefix sum is the sum of the ...
Marc Carlsan's user avatar
2 votes
1 answer
136 views

I am trying to implement Quick Sort in GNU COBOL (version 3.2.2) using a recursive subprogram. The sorting logic is standard and works perfectly in other languages (C, Python), but when I run it in ...
TranTrung's user avatar
0 votes
1 answer
244 views
+50

I'm trying to implement the Cooper–Harvey–Kennedy algorithm from this paper in C++. The original is used to find dominators, however in my case I need to find the postdominators. For this, I am aware ...
DeepQuantum's user avatar
8 votes
2 answers
368 views

Consider an array of a permutation P of length n (n > 2), namely some order of the integers 1 through n. Example of P with length n = 7, [6,5,2,3,7,1,4] A "score" of a permutation is ...
user31824378's user avatar
-2 votes
1 answer
175 views

I’m trying to implement an in-place Quick Sort in Python. I have two slightly different versions of my partitioning logic, and I’m confused because both seem correct on small arrays, but the second ...
Lisguen's user avatar
  • 11
6 votes
3 answers
383 views

I've got a list P of 2-dimensional points, 100 ≤ |P| ≤ 100000, and a list C of circle centers, 100 ≤ |C| ≤ 100000. All coordinates (x,y) ∈ P or (x,y) ∈ C are integral, 0 ≤ x,y ≤ 4095. P and C may ...
hidefromkgb's user avatar
  • 6,002
2 votes
1 answer
130 views

I am tasked with a question as follows: We have n players and we want to hold a wrestling tournament with exactly n * (n - 1) / 2 matches. In each day a player can only play at most one match. However,...
Eastern Skill's user avatar
-2 votes
1 answer
95 views

I have a Set of 2D points that I want to create a set of areas from, similar to a Voronoi Diagram. The difference is that I would like these areas to be blended, like in the following image. I wouldn'...
CptHavvock's user avatar
2 votes
1 answer
116 views

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 ...
Kemsikov's user avatar
  • 640
-2 votes
1 answer
117 views

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 ...
Salma Ahmed's user avatar
3 votes
3 answers
188 views

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 ...
user567_9's user avatar
1 vote
2 answers
128 views

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 ...
PostalCat's user avatar
7 votes
3 answers
240 views

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 ...
The Lost Petrol's user avatar
-3 votes
1 answer
97 views

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%...
Lance Pollard's user avatar
2 votes
1 answer
123 views

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 ...
nj16's user avatar
  • 133
-2 votes
1 answer
152 views

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) ...
Alan Burstein's user avatar
5 votes
3 answers
220 views

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). ...
Jared McCarthy's user avatar
8 votes
1 answer
237 views

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 ...
Dominik Kaszewski's user avatar
3 votes
2 answers
483 views

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: ...
QA Android Alfa's user avatar
4 votes
1 answer
308 views

I was reading the paper Beam-Stack Search: Integrating Backtracking with Beam Search by Rong Zhou and Eric A. Hansen and I was attempting to implement it in Java (see PathFinding.java repository in ...
coderodde's user avatar
  • 957
0 votes
0 answers
90 views

I have a bunch of data which is indexed by key/value pairs. For example I might have x=1, y=2, z=3 => data="1,2,3" and x=1,y=2 => data="1,2" etc. The operations I need to ...
Mumrah's user avatar
  • 422
0 votes
0 answers
71 views

Recently, I developed a MATLAB-based simulation to evaluate my robot pathfinding algorithm. The robots operate on a network of unidirectional tracks, where each robot computes a single path from its ...
CangWangu's user avatar
  • 181
7 votes
3 answers
293 views

The problem is to find the longest sequence of numbers from 1 to 100 such that each number is either multiple or divisor or the previous, and with no repetition. For example, 50 25 5 35 7 63 21 is a ...
Zorm's user avatar
  • 71
0 votes
1 answer
96 views

I’m writing a chess engine in C++ that communicates via the UCI protocol, and I need an efficient way to check whether the allocated search time has been exceeded without adding too much overhead. The ...
Viliam Holly's user avatar
1 vote
1 answer
110 views

The current problem I'm having is that when the code runs it shows me "None" in the terminal. /usr/local/bin/python3.12/Users/jaredmccarthy/Desktop/2025/ejercicios_leetcode.py None Process ...
Jared McCarthy's user avatar
1 vote
1 answer
76 views

Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). What's the problem with the following implementation? How to fix it?...
peter8015's user avatar
2 votes
0 answers
114 views

I'm researching about maintaining order in a list like JIRA, and I come across Jira Lexorank. I've already understood it's core concept, but there are 2 questions that I struggle to find the in depth ...
nanh's user avatar
  • 51
5 votes
2 answers
251 views

Okay, here's the problem I have. I'd like to do something like this: V(n,k) generates all n-sized permutations in which each permutations contains all digits from 0 to k-1 in lexicographic order. V(2,...
Reptorian's user avatar
-2 votes
2 answers
150 views

I have an application where I have a Rule object that has a list of Filter predicates. I will be comparing many Events to the predicates, and want to know if they all match. Most Events will not match ...
Andrew Rueckert's user avatar
7 votes
2 answers
1k views

I'm trying to solve the following problem: Minimal Grid Path (CSES). Here is the content of the problem: You are given an n x n grid whose each square contains a letter. You should move from the ...
crxyz's user avatar
  • 1,128
-2 votes
3 answers
845 views

This is CSES Mountain Range problem: https://cses.fi/problemset/task/3314/ There are n mountains in a row, each with a specific height. You begin your hang gliding route from some mountain. You can ...
Isabella's user avatar
4 votes
2 answers
399 views

A lexicographical swap is defined as: At each step, pick the earliest possible inversion (i, j) (smallest i, then smallest j > i with a[i] > a[j]) and swap them. Repeat until the array is sorted....
ISG's user avatar
  • 49
3 votes
2 answers
194 views

The method is working as intended, but while I was trying multiple cases, I got this weird issue, so hopefully someone can understand why and explain it to me, since 6 > 5 looks logically sound to ...
chtasmino's user avatar
0 votes
2 answers
246 views

I am solving this problem- U and K are vectors is R3. U rotated around K by an angle θ in radian produces a new vector V. Find the components of V as functions of U , K and θ. I solved the problem ...
uran42's user avatar
  • 469
5 votes
3 answers
154 views

I'm currently building my portfolio and im making a typewriter effect for some text : "use client" import { useEffect, useState } from "react" type Typewriter = { textToWrite: ...
Rayan's user avatar
  • 53
2 votes
2 answers
140 views

I am building a Digital Audio Workstation in the likes of FL Studio and have a chord detection algorithm. It works as it is but is extremely inefficient which I need to optimize for. First we start ...
Caden The Yak's user avatar
0 votes
4 answers
589 views

You are given an unweighted tree with N nodes and each node starts with value 0. There will be Q queries. The 1st type of query will change the value at a node to a new value. The 2nd type of query ...
Isabella's user avatar
1 vote
1 answer
157 views

I'm trying to solve LeetCode 199. Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. I've ...
Benny's user avatar
  • 519
0 votes
0 answers
47 views

I have a sequence of points in 2d that are rendered as a thick line by using quads.The quads are formed by extruding the curve around its center line in the normal direction. The figure is showing a ...
user877329's user avatar
  • 6,286
3 votes
0 answers
255 views

For a project of mine related to prime counting, I am interested in iterating over special kind of semiprimes. For a given n, I want to iterate over semiprimes k=pq with the following properties/...
MC From Scratch's user avatar
2 votes
1 answer
302 views

There is a row of toys, where each toy is represented as either: 1 → red toy (needs to be painted blue), 0 → blue toy (already painted). An integer k is given. An operation can be performed as ...
CodeCrusader's user avatar
2 votes
1 answer
201 views

An abstract data type maintains a subset of numbers {0,1,2,...,n-1}. The operations allowed on this are: insert(i) - Insert element i in the subset if not already present. find(i) - Return True iff ...
abora's user avatar
  • 1,101
10 votes
3 answers
611 views

This is the code I have written for searching a node in a tree as a part of my assignment: typedef struct NODE { int key; struct NODE *left, *right; } Node; Node *search(Node *head, int key)...
M.B.'s user avatar
  • 279
4 votes
1 answer
224 views

The NYT Spelling Bee game is a word game, where given 7 letters including 1 "center letter", you find words at least 4 letters long that must use the "center letter". The scoring ...
qwr's user avatar
  • 11.5k

1
2 3 4 5
2430