language-agnostic Questions
17
Solved
This is a long text. Please bear with me. Boiled down, the question is: Is there a workable in-place radix sort algorithm?
Preliminary
I've got a huge number of small fixed-length strings that ...
Harriette asked 20/1, 2009 at 21:4
54
Solved
How do I check if a number is a palindrome?
Any language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).
Cristophercristy asked 13/10, 2008 at 22:10
17
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing...
Yourself asked 16/9, 2008 at 18:53
8
Solved
I need to generate a random number, but it needs to be selected from the set of binary numbers with equal numbers of set bits. E.g. choose a random byte value with exactly 2 bits set...
00000000 -...
Hanleigh asked 11/12, 2012 at 15:27
12
Solved
Given a list of opponent seeds (for example seeds 1 to 16), I'm trying to write an algorithm that will result in the top seed playing the lowest seed in that round, the 2nd seed playing the 2nd-low...
Runofthemine asked 2/12, 2011 at 10:57
8
Solved
The terms do appear to be defined differently, but I've always thought of one implying the other; I can't think of any case when an expression is referentially transparent but not pure, or vice-ver...
Tilsit asked 1/2, 2011 at 17:6
9
Solved
I need a data structure that always holds the n largest items inserted so far (in no particular order).
So, if n is 3, we could have the following session where I insert a few numbers and the con...
Nur asked 19/2, 2009 at 6:4
5
Solved
There are many people who think that the concept of the special value null (as it is used in lanuages like C, Java, C#, Perl, Javascript, SQL etc.) is a bad idea. There are several questions about ...
Merce asked 23/1, 2015 at 9:0
6
Solved
Has anyone of you ever implemented a Fibonacci-Heap? I did so a few years back, but it was several orders of magnitude slower than using array-based BinHeaps.
Back then, I thought of it as a valua...
Jenifer asked 2/2, 2009 at 20:46
29
Solved
I'm trying to figure out how to detect the type of credit card based purely on its number. Does anyone know of a definitive, reliable way to find this?
Maurits asked 16/9, 2008 at 14:16
6
Solved
I know that Knapsack is NP-complete while it can be solved by DP. They say that the DP solution is pseudo-polynomial, since it is exponential in the "length of input" (i.e. the numbers of bits requ...
Magyar asked 27/12, 2010 at 12:19
11
Solved
I've been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (and often the same operators)...
At a core level, what does bit-shifting (<<, >...
Subfamily asked 26/9, 2008 at 19:47
6
What is the most efficient way to generate a large (~ 300k vertices) random planar graph ("random" here means uniformly distributed)?
Lulalulea asked 12/7, 2010 at 20:33
12
Solved
I've heard of the idea of bootstrapping a language, that is, writing a compiler/interpreter for the language in itself. I was wondering how this could be accomplished and looked around a bit, and s...
Ogdoad asked 17/8, 2008 at 6:46
23
Solved
Is there a difference in ++i and i++ in a for loop? Is it simply a syntax thing?
Bolognese asked 27/1, 2009 at 17:53
24
Solved
For a person without a comp-sci background, what is a lambda in the world of Computer Science?
Frederick asked 19/8, 2008 at 16:20
14
Solved
What is the most efficient method to evaluate the value of "n choose k" ?
The brute force way I think would be to find n! / k! / (n-k)! by calculating each factorial separately.
A better ...
Brittnee asked 8/3, 2013 at 19:35
2
Solved
When attempting to use a trigonometric function in my programming language, I get a seemingly wildly incorrect result.
For example,
sin(90) = 0.8939966636005579
But I would expect sin(90) to...
Ninnyhammer asked 1/12, 2023 at 12:52
3
Solved
I have the intrisic and extrinsic parameters of the camera.
The extrinsic is a 4 x 4 matrix with rotation and translation.
I have sample data as under, I have this one per camera image taken.
2....
Braithwaite asked 18/11, 2011 at 6:12
13
Solved
Assuming a URL of:
www.example.com/?val=1#part2
PHP can read the request variables val1 using the GET array.
Is the hash value part2 also readable? Or is this only upto the browser and JavaScri...
Periodicity asked 2/6, 2009 at 17:41
65
How can I check if a given string is a valid URL address?
My knowledge of regular expressions is basic and doesn't allow me to choose from the hundreds of regular expressions I've already seen on ...
Kruse asked 2/10, 2008 at 10:53
10
Solved
In several modern programming languages (including C++, Java, and C#), the language allows integer overflow to occur at runtime without raising any kind of error condition.
For example, consider t...
Gemmule asked 19/9, 2008 at 16:53
34
Solved
Consider the following code:
0.1 + 0.2 == 0.3 -> false
0.1 + 0.2 -> 0.30000000000000004
Why do these inaccuracies happen?
Submediant asked 25/2, 2009 at 21:39
2
Solved
This might be better asked on Math.SE, but I'll try here first:
If I have two arbitrary triangles in 3D space, how can I determine the minimum distance between them? See the following:
It's diffi...
Dantedanton asked 3/12, 2018 at 22:26
4
A promise represents a value that might become available in the future (or fails to do so).
What I am looking for is a data type which represents an available value that might become unavailable i...
Polly asked 28/9, 2014 at 11:32
© 2022 - 2025 — McMap. All rights reserved.