Questions tagged [language-agnostic]

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

Questions that are independent of programming language. These questions are typically more abstract than other categories.


A typical usage scenario with this tag is that you have a problem and you don't know how to solve much less what to write in a specific programming language.

So you would first ask a how type question with the tag and usually . Then when you get an acceptable answer you would code it in a specific programming language. If you have problems then you can refer back to the related question with the tag then in the new what question add the specific programming language, e.g. ,


Free Language Agnostic Programming Books


References:

Dictionary of Algorithms and Data Structures (NIST)

8332 questions
11
votes
3 answers

Find tunnel 'center line'?

I have some map files consisting of 'polylines' (each line is just a list of vertices) representing tunnels, and I want to try and find the tunnel 'center line' (shown, roughly, in red below). I've had some success in the past using Delaunay…
sje397
  • 41,293
  • 8
  • 87
  • 103
11
votes
3 answers

Online algorithm for calculating absolute deviation

I'm trying to calculate the absolute deviation of a vector online, that is, as each item in the vector is received, without using the entire vector. The absolute deviation is the sum of the absolute difference between each item in a vector and the…
fmark
  • 57,259
  • 27
  • 100
  • 107
11
votes
5 answers

Multiple parameter optimization with lots of local minima

I'm looking for algorithms to find a "best" set of parameter values. The function in question has a lot of local minima and changes very quickly. To make matters even worse, testing a set of parameters is very slow - on the order of 1 minute - and I…
Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
11
votes
12 answers

The "You're Doing It Wrong!!" feeling

NB - This question is not a stab at RoR or at Redmine's plugin system I have been working on a custom plugin for Redmine, a project manager platform built with Ruby on Rails (RoR). Now I am not really a RoR or for that matter, a Ruby guy. I have…
theman_on_vista
11
votes
3 answers

Functional Programming: Does a list only contain unique items?

I'm having an unsorted list and want to know, whether all items in it are unique. My naive approach would be val l = List(1,2,3,4,3) def isUniqueList(l: List[Int]) = (new HashSet()++l).size == l.size Basically, I'm checking whether a Set containing…
tstenner
  • 10,080
  • 10
  • 57
  • 92
11
votes
4 answers

Find the simplest rational number between two given rational numbers

I found a problem related to rational numbers. Two rational numbers are given and the task is to find the simplest rational number between them. For this problem, the simplicity of a rational number could be defined as the rational number with the…
Tom Pažourek
  • 9,582
  • 8
  • 66
  • 107
11
votes
10 answers

Linear feedback shift register?

Lately I bumped repeatedly into the concept of LFSR, that I find quite interesting because of its links with different fields and also fascinating in itself. It took me some effort to understand, the final help was this really good page, much better…
MattiaG
  • 241
  • 1
  • 2
  • 9
11
votes
3 answers

Uses of self referencing lists

I know it is possible to create a self referencing list in languages like Python: >>> my_list = [1,2] >>> my_list.append(my_list) >>> print my_list [1,2,[...]] >>> print my_list[0] 1 >>> print my_list[2] [1,2,[...]] What algorithms benefit from…
Escualo
  • 40,844
  • 23
  • 87
  • 135
11
votes
22 answers

Should I prepare my code for future changes?

Should I prepare my code for possible/predicted future changes so that it's easier to make these changes even if I don't really know if these changes will be required anytime?
cretzel
  • 19,864
  • 19
  • 58
  • 71
11
votes
4 answers

How can I find only 'interesting' words from a corpus?

I am parsing sentences. I want to know the relevant content of each sentence, defined loosely as "semi-unique words" in relation to the rest of the corpus. Something similar to Amazon's "statistically improbable phrases", which seem to (often)…
Alex Mcp
  • 19,037
  • 12
  • 60
  • 93
11
votes
9 answers

How to calculate the angle of a vector from the vertical?

Im trying to find out the angle (in degrees) between two 2D vectors. I know I need to use trig but I'm not too good with it. This is what I'm trying to work out (the Y axis increases downward): I'm trying to use this code at the moment, but it's…
Niall
  • 757
  • 3
  • 9
  • 17
11
votes
9 answers

How do I apply gravity to my bouncing ball application?

I've written a fairly simple java application that allows you to drag your mouse and based on the length of the mouse drag you did, it will shoot a ball in that direction, bouncing off walls as it goes. Here is a quick screenshot: alt text…
anon
11
votes
1 answer

Does unary minus just change sign?

Consider for example the following double-precision numbers: x = 1232.2454545e-89; y = -1232.2454545e-89; Can I be sure that y is always exactly equal to -x (or Matlab's uminus(x))? Or should I expect small numerical differences of the order or eps…
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
11
votes
4 answers

Algorithmic issue: determining "user sessions"

I've got a real little interesting (at least to me) problem to solve (and, no, it is not homework). It is equivalent to this: you need to determine "sessions" and "sessions start and end time" a user has been on in front of his computer. You get the…
NoozNooz42
  • 4,238
  • 6
  • 33
  • 53
11
votes
3 answers

Finding blank regions in image

This question is somewhat language-agnostic, but my tool of choice happens to be a numpy array. What I am doing is taking the difference of two images via PIL: img = ImageChops.difference(img1, img2) And I want to find the rectangular regions that…