language-agnostic Questions
11
Solved
My friend ran into a question in an interview and he was told that there is an O(n) solution. However, neither of us can think it up. Here is the question:
There is a string which contains just ( ...
Menace asked 20/9, 2014 at 19:6
9
Solved
Is there any fast way to find the largest power of 10 smaller than a given number?
I'm using this algorithm, at the moment, but something inside myself dies anytime I see it:
10**( int( math.log1...
Wistful asked 22/12, 2010 at 21:4
3
Solved
Disclaimer: Feel free to close this as "too localized", if you think it is inappropriate for StackOverflow. Since there's quite a large German-speaking community here, I thought I'd give it a try.
...
Stunt asked 31/8, 2011 at 9:33
5
I often see the terms "binary" and "executable" seemingly used interchangeably. Isn't it two terms to describe the same thing; the executable output program after a compilation ...
Tousle asked 20/1, 2020 at 15:22
13
Solved
I've got lots of source code files written in various languages, but none of them have a standard comment at the top (sometimes even across the same project). Some of them don't have any header com...
Phillisphilly asked 10/1, 2010 at 5:15
6
Solved
We all know that the logical && operator short circuits if the left operand is false, because we know that if one operand is false, then the result is also false.
Why doesn't the bitwise &...
Mortification asked 13/3, 2012 at 16:46
10
Solved
We use a data acquisition card to take readings from a device that increases its signal to a peak and then falls back to near the original value. To find the peak value we currently search the arra...
Subdominant asked 6/8, 2008 at 10:23
12
Solved
Given a 2D circle with 2 angles in the range -PI -> PI around a coordinate, what is the value of the smallest angle between them?
Taking into account that the difference between PI and -PI is no...
Miserly asked 10/12, 2009 at 6:1
12
Solved
A hypothetical situation: you've implemented a password handling system, and it doesn't impose any limitations at all on what characters can be used. You want to set up some rules that are a reason...
Venetian asked 6/10, 2009 at 8:40
4
Solved
As the title states when would you recommend the use of the mediator design pattern and where do you see it used incorrectly?
Aymer asked 17/12, 2008 at 3:46
41
Solved
I am analyzing the following data:
Raw data (seperated with spaces):
1 1 1.1 1 0.9 1 1 1.1 1 0.9 1 1.1 1 1 0.9 1 1 1.1 1 1 1 1 1.1 0.9 1 1.1 1 1 0.9 1 1.1 1 1 1.1 1 0.8 0.9 1 1.2 0.9 1 1 1.1 1.2 1...
Andreasandree asked 22/3, 2014 at 20:48
6
Solved
I need to choose a compression algorithm to compress some data. I don't know the type of data I'll be compressing in advance (think of it as kinda like the WinRAR program).
I've heard of the follo...
Toler asked 7/3, 2010 at 18:52
10
Solved
So, here's a funny little programming challenge. I was writing a quick method to determine all the market holidays for a particular year, and then I started reading about Easter and discovered just...
Cassatt asked 3/2, 2010 at 14:19
40
Solved
Inversion of Control (IoC) can be quite confusing when it is first encountered.
What is it?
Which problem does it solve?
When is it appropriate to use and when not?
Atalya asked 6/8, 2008 at 3:35
6
Solved
It's a pretty normal binary tree, except for the fact that one of the nodes may be empty.
I'd like to find a way to output it in a horizontal way (that is, the root node is on the left and expands...
Antineutrino asked 16/6, 2010 at 20:35
23
Solved
I'd like to generate unique random numbers between 0 and 1000 that never repeat (i.e. 6 doesn't show up twice), but that doesn't resort to something like an O(N) search of previous values to do it....
Geny asked 12/10, 2008 at 20:34
10
I have written a system that summarizes a long document containing thousands of words. Are there any norms on how such a system should be evaluated in the context of a user survey?
In short,...
Lacto asked 26/3, 2012 at 20:26
23
What is a callback function?
Wrote asked 5/5, 2009 at 10:18
5
Solved
To calculate min edit distance (the minimum amount of insertions, deletions and substitutions required to transform one word to another), a dynamic programming solution is based on the recurrence r...
Earsplitting asked 7/3, 2016 at 3:55
2
What is the standard, cross-platform way to detect stale pid file in a Unix environment? Say I would like to kill an old instance of my application, but I certainly don't want to disrupt an unrelat...
Nelsen asked 23/10, 2016 at 17:16
3
Is it possible to configure git diff to respect indentation and syntax?
I am not talking about ignoring indentation and spaces, but rather to use blank lines, indentation levels and possibly bracke...
Howlyn asked 11/6, 2014 at 12:15
36
Why prefer composition instead of inheritance? What trade-offs are there for each approach? And the converse question: when should I choose inheritance instead of composition?
Bracket asked 8/9, 2008 at 1:58
8
Solved
Are shift operations O(1) or O(n) ?
Does it make sense that computers generally require more operations to shift 31 places instead of shifting 1 place?
Or does it make sense the number of operati...
Anacreontic asked 31/1, 2012 at 17:5
7
Solved
What's the difference between application layer and business logic layer? I kind of understand that business layer provides business specific services and application layer couples business service...
Franchescafranchise asked 13/4, 2010 at 15:17
3
Solved
Google's Encoded Polyline Algorithm Format:
How do you decode this?
Perhaps run the algorithm backwards; But I'm stuck at step 5: without the initial value, how do I know if it's positive/ne...
Hotze asked 18/2, 2012 at 12:9
1 Next >
© 2022 - 2024 — McMap. All rights reserved.