Questions tagged [language-agnostic]

Use this tag for PROGRAMMING QUESTIONS that are independent of any particular programming language.

655 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8votes
2answers
2kviews

Google interview algorithm puzzle: expected size of the largest connected component in a random simple graph (N nodes, N edges)?

Given a random simple graph of N nodes, N edges, and a uniform edge probability p, what is the expected size of the largest connected component? The only initial input parameter supplied is N, ...
user avatar
6votes
0answers
308views

Which OS / platforms implement wait morphing optimization?

Which major OS / platforms implement wait morphing? This question came up when I noticed that there's no clearcut best practice about whether one should signal a condition variable with mutex locked ...
user avatar
  • 44.3k
6votes
1answer
320views

minimum-size Vec3 that move Physics object to make penetration = 0

Here is an example (see image) :- The 2 reddish rectangles are static objects (i.e. it can't move). The bluish ball is dynamic object. So far, I manage to get all penetrating information. ...
user avatar
  • 1,050
6votes
2answers
135views

What "time precise" garbage collection algorithms do exist?

Which garbage collection algorithms can recognize garbage objects as soon as they become garbage? The only thing which comes to my mind is reference counting with an added cycle-search every time a ...
user avatar
  • 5,721
5votes
0answers
284views

Clause subsumption algorithm

An important part of automated theorem proving is cutting down redundancy by figuring out when one clause subsumes another. Intuitively, a clause (first-order logic formula in CNF) C subsumes another ...
user avatar
  • 28.2k
5votes
1answer
215views

Is there a programming term for selecting or inserting similar to "upsert"?

Is there a programming term for a widget/service that has the ability to either select an existing item or create/insert a new item? Maybe like how "upsert" is a combination of updating existing or ...
user avatar
  • 25.9k
5votes
2answers
576views

Algorithm to assign Team based on player's choice

I found very similar questions in here but I couldn't find a solution which would work for me. So here's the problem: I have 4 teams and a vast (higher than 4) number of players. Each player ranks ...
user avatar
  • 73
5votes
1answer
1kviews

Modelling e-commerce website checkout

Typically, when a customer clicks the "checkout" button on an e-commerce website, they go through a checkout process something like this: Update/confirm product quantities in shopping cart Enter ...
user avatar
  • 629
5votes
6answers
700views

Linear time solution for this

I was asked this problem during an interview. You are standing at 0 and you have to reach a position X. You can take a jump of upto D (1 to D). If X > D, it's obvious that you can't reach the ...
user avatar
  • 2,319
5votes
1answer
652views

generate histogram from database

In a MySQL database there's a table with a single numeric value column. I want to plot the distribution of these values as a bar chart/histogram with the following requirements: there should be a ...
user avatar
  • 181k
5votes
0answers
189views

Ensuring a hash function is well-mixed with slicing

Forgive me if this question is silly, but I'm starting to learn about consistent hashing and after reading Tom White blog post on it here and realizing that most default hash functions are NOT well ...
user avatar
5votes
4answers
65views

!= 0 vs > 0 when checking if an array is empty or not?

I've debated writing this question a dozen times over the last few years. Mostly because I'm not sure it matters. I'm looking for the most technical answer because on the surface I know it doesn't ...
user avatar
  • 22.7k
5votes
1answer
525views

Send an email (or any message) once and only once inside a retryable operation

I have a program that is charging a user's credit card. The card is charged via a 3rd party API. When I get a response from the 3rd party API, I update the internal representation of the user's ...
user avatar
  • 13.9k
4votes
0answers
521views

Framework-agnostic template engine

I have a project using nodejs, gulp and some npm libs where I use pug template engine. I also have a project using ruby, middleman and some gems where I use slim template engine. There are several ...
user avatar
  • 2,648
4votes
0answers
644views

Vectorization of 1 bit Raster Images

I want to convert low-res, raster images that are composed of only two colors into a vector image. My current approach is simple. I use the Moore Contour tracing algorithm to "walk" around the edges ...
user avatar
  • 981
4votes
0answers
94views

Algorithm to determine how many items are left (at most) between sets that share items

Suppose that we want to take items from 4 sets, S1-S4. The sets share items between them. Some example sets would be: S1 = ['b1']; S2 = ['b1', 'b2']; S3 = ['b1', 'b2', 'b3']; S4 = ['b1', 'b2', 'b3', '...
user avatar
  • 1,381
4votes
1answer
699views

Generating all DAGs with n vertices

I would like to generate all DAGs with n vertices, up to isomorphism - that is, unlabeled DAGs without duplicates. Yes, I know there are a lot of these, but I'm mostly concerned with small numbers (e....
user avatar
  • 55.9k
4votes
1answer
334views

Finding the average intersection line for multiple planes

I have some planes in 3D space, which in theory should all intersect at the same line. Each plane is calculated by taking 3 measured points. However there is some error in the measurement of these ...
user avatar
  • 12.2k
4votes
2answers
182views

QuickSort for sorting part Mergesort?

Ques: Mergesort divides a list of numbers into two halves and calls itself recursively on both of them. Instead can you perform quicksort on the left half and mergesort on the right half? If yes, show ...
user avatar
  • 159
4votes
2answers
66views

How to pick a max number of items in a sequence that needs to have k items between them?

I'm studying Algorithms and I usually stumble upon this kind of question. Ok, I have an list of numbers and I have to find the max sub-list of this list in which the distance between each number is ...
user avatar
  • 354
4votes
0answers
199views

Names for camera moves

I've got a 3D scene and want to offer an API to control the camera. The camera is currently described by its own position, a look-at point in the scene somewhere along the z axis of the camera frame ...
user avatar
  • 54.1k
4votes
2answers
683views

How to tell if two line segments with a non-zero width intersect

A line segment can be defined by a pair of points. There are well-known algorithms for finding whether two line segments in 2D space intersect. But what if we make it a bit trickier by adding a ...
user avatar
4votes
1answer
216views

Beyond type theory

There has been much fuss about dynamically vs. statically typed languages. To my eye, however, while statically typed languages enable the compiler (or interpreter) to know a bit more about your ...
user avatar
  • 164k
4votes
1answer
619views

Multidimensional interpolation

Given a dataset of samples in a multi dimensional space (in my case a 4D space) where the samples are present on all the corners of the 4D cube and a substantial amount of samples within this cube but ...
user avatar
4votes
3answers
322views

Reordering of data segments within a file

I am trying to find an algorithm in with perhaps an example in C, C++, C#, Java or really any language to help solve a reordering problem I have been facing. The objective is to take a series of ...
user avatar
4votes
0answers
772views

Programmatically disabling mouse acceleration in Windows

When I use my laptop's trackpad I want acceleration on, but when I have a mouse plugged in I normally want it off. I couldn't find a fast way to make the change, so I'd like to make a simple ...
user avatar
  • 2,372
4votes
1answer
2kviews

Combination of percentiles from different data sets: how can this be accomplished?

I need to compute the Nth percentiles of a series of related, but segmented data sets. The combined data sets are too large to compute all at once due to memory limitations, but the framework to ...
user avatar
  • 490
4votes
1answer
299views

Method for runtime comparison of two programs' objects

I am working through a particular type of code testing that is rather nettlesome and could be automated, yet I'm not sure of the best practices. Before describing the problem, I want to make clear ...
user avatar
  • 19.9k
4votes
1answer
152views

Where to ask for language design review?

I'm designing an xml-base language that is meant to be widely used. I've made an xsd file to define it. I'm in the process to finish the english specification. My humility tells me that I really need ...
user avatar
  • 63.5k
4votes
3answers
224views

web page layout from image or mockup - expectations?

I recently asked a contractor to layout a web page design using a mockup I designed in Balsamiq. He surprised me by telling me that he couldn't proceed unless he had a PSD of the entire page that he ...
user avatar
  • 980
4votes
2answers
238views

How do you set specific properties to a class created by an abstract factory?

Is it possible to have concrete factories create concrete classes with type specific parameters for them, using the abstract factory pattern? Or do the different concrete classes created by their ...
user avatar
  • 6,864
3votes
0answers
122views

Understanding Generic Invariance, Covariance and Contravariance

Variance in generics is something that has always confused me. The following rules are what I was led to believe: Invariant T: Only accepts types of T; nothing more, nothing less. Covariant T: ...
user avatar
3votes
0answers
57views

How to build a directed graph with paths shorter than a given size?

How to build a directed graph with a given number of nodes N so that for every pair of nodes there is a path of size < L. I'd like also to minimize the number of edges.
user avatar
  • 38.8k
3votes
1answer
98views

Algorithm for finding the vertices of a union of axis-aligned hypercuboids in the nonnegative orthant, all with one vertex at the origin

Suppose I have a collection of N axis-aligned hypercuboids in D dimensions. Each hypercuboid has one vertex at the origin, and one vertex in the positive orthant (i.e. with all coordinates strictly ...
user avatar
  • 208
3votes
0answers
1kviews

How to determine which rooms are effectively identical in a given maze

The problem in question can be found here TL;DR: There is a maze made up of circular rooms connected by indistinguishable corridors, the goal of players is to walk around and map out the whole maze. ...
user avatar
  • 39
3votes
0answers
92views

Efficient/Performant way to visualise a lot of data in javascript + D3/mapbox

I am currently looking at an efficient way to visualise a lot of data in javascript. The data is geospatial and I have approximately 2 million data points. Now I know that I cannot give that many ...
user avatar
  • 3,224
3votes
0answers
171views

How to generate a "phantom" string for a Unicode string, consisting of whitespace characters of same width?

Given a sequence of Unicode characters, how can I obtain a string of whitespace characters that has the same width (at least in monospace fonts that display each character with single or double width ...
user avatar
3votes
0answers
138views

Setting up a tech-agnostic Atomic Design workflow

We are currently working on setting up a design system for our company and part of the process is to create a pattern library based on Atomic Design. Our frontend team is currently using React Styled ...
user avatar
  • 141
3votes
0answers
91views

Test for my topological/dependancy sort

This is more of a puzzle than a question per se, because I think I already have the right answer - I just don't know how to test it (if it works under all scenarios). My program takes input from user ...
user avatar
  • 3,169
3votes
0answers
123views

Static Linking After the Fact

Would it be possible (whether or not any tools are currently capable of this) to statically link in some or all dynamic library dependencies of an executable after it's been compiled? I mean ...
user avatar
  • 3,805
3votes
4answers
126views

Sum of numbers with approximation and no repetition

For an app I'm working on, I need to process an array of numbers and return a new array such that the sum of the elements are as close as possible to a target sum. This is similar to the coin-counting ...
user avatar
  • 1,588
3votes
1answer
1kviews

Efficient algorithm to generate crosswords (NYtime's style)

I want to find an efficient way to generate Crosswords. I have read solutions mentioned here. This generates an easy crossword, where as I am looking for an efficient and optimised way to generate ...
user avatar
  • 2,291
3votes
0answers
843views

Naming conventions around internationalization

I am currently trying to internationalize my application. Despite reading some documentation or looking at source code, I am still not sure about naming standards/conventions around ...
user avatar
  • 1,328
3votes
1answer
119views

Improving the time complexity of DFS using recursion such that each node only works with its descendants

Problem There is a perfectly balanced m-ary tree that is n levels deep. Each inner node has exactly m child nodes. The root is said to be at depth 0 and the leaf nodes are said to be at level n, so ...
user avatar
  • 14.5k
3votes
0answers
506views

Photoshop's spot-color channel mixing algorithm

Photoshop seems to have a special mode for blending spot-color channels. Let's look at an example: blending full opacity red #ff3c1f with full opacity cyan #1cd4c6. If I create two spot-color ...
user avatar
  • 854
3votes
1answer
356views

How to implement HMAC-SHA authentication from scratch?

I would like to implement authentication for a web app api using a similar technique to the AWS Signature Process. The server will render html for user web browser clients. The app will also return ...
user avatar
  • 3,355
3votes
0answers
414views

Term for accessor/mutator method

I am a bit tired of using "accessor-slash-mutator" description for a methods that may work as both accessors and mutators. Is there a single-word term for such methods in OOP terminology?
user avatar
  • 891
3votes
4answers
2kviews

Release Management to different environments (Dev/QA/Integration/Stable)

I recently joined a company as Release Engineer where a large number of development teams develop numerous services, applications, web-apps in various languages with various inter-dependencies among ...
user avatar
  • 778
3votes
0answers
2kviews

Definitive regex to secure against path traversal, plus pseudo-code to handle related items

I am creating a webserver framework (in Node.JS), and I want to include path traversal as a built in feature so that the apps don't have to. Perhaps this can become the definitive guide to securing ...
user avatar
  • 80.6k
3votes
0answers
397views

How does poker tracking software evaluates live hands

I'm just curious how they make this kind of software. Do they? Capture the screen and use an OCR library to track hands Determine the memory locations of the hands and read it directly from there ...
user avatar
  • 6,702

15 30 50 per page
1
2 3 4 5
14