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
5 answers

name of class that manipulates the entities

i have a general question regarding naming convention. if I separate the data and operations into two separate classes. one has the data elements (entity), the other class manipulates the entity class. what do we usually call that class that…
cyberguest
  • 123
  • 1
  • 5
11
votes
1 answer

Binary file layout reference

Where are some good sources of information on binary file layout structures? If I wanted to pull in a BTrieve index file, parse MP3 headers, etc. Where does one get reliable information?
Brett Veenstra
  • 47,674
  • 18
  • 70
  • 86
11
votes
1 answer

Difference between lazy evaluation and promises/futures

What's the difference between a promise or future and a lazily evaluated function/object? They both act like a placeholder for a deferred computation, and I understand that the principles that they operate on are different, but what's the actual…
Pedro Montoto García
  • 1,672
  • 2
  • 18
  • 38
11
votes
4 answers

Rotated rectangle rasterisation algorithm

In a nutshell: I want to do a non-approximate version of Bresenham's line algorithm, but for a rectangle rather than a line, and whose points aren't necessarily aligned to the grid. Given a square grid, and a rectangle comprising four…
Max
  • 2,760
  • 1
  • 28
  • 47
11
votes
3 answers

Which data clustering algorithm is appropriate to detect an unknown number of clusters in a time series of events?

Here's my scenario. Consider a set of events that happen at various places and times - as an example, consider someone high above recording the lightning strikes in a city during a storm. For my purpose, lightnings are instantaneous and can only hit…
wishihadabettername
  • 14,231
  • 21
  • 68
  • 85
11
votes
3 answers

An algorithm to find a pair of sums from a list of numbers?

Suppose you have the following list of numbers, {3,6,10,9,13,16,19}, not necessarily in that order. Now, not knowing that this is the set of the possible combination of the set {3,6,10}, is there an algorithm, in any programming language that can be…
Programmer
  • 421
  • 1
  • 7
  • 21
11
votes
5 answers

What to cache when 99.9% of your data changes frequently?

Okay I know I asked about this before, and the answer was basically cache data that doesn't change often. Well what does one do when at least 99.9% of the data changes? In my project the only tables that doesn't get updated or won't get updated…
dswatik
  • 9,129
  • 10
  • 38
  • 53
11
votes
4 answers

Traversing a complete binary min heap

I am not sure how to traverse the tree structure below so that the nodes are always in ascending order. Heapifying the array [9 8 7 6 5 4 3 2 1 0] results in the array [0 1 3 2 5 4 7 9 6 8] which I think corresponds to this representation: Wanting…
Inuart
  • 1,432
  • 3
  • 17
  • 28
11
votes
5 answers

How for( ; ;) is infinite loop?

Like many other question explained that while(true) {} is an infinite loop and so is for( ; ;) my question is while(true) makes sense the conditions is always true but there is no vivid condition true/false in for( ; ;) so how is the later an…
user2009750
  • 3,169
  • 5
  • 35
  • 58
11
votes
8 answers

throw new exception vs writing message back to user (avoiding exception)

I see a lot of code written where an exception is thrown if a parameter is not in the right form, or whatever. Basically "throw new ...". What is the benefit of this? The exception can be avoided by checking the parameters (Eg if null, write message…
GurdeepS
  • 65,107
  • 109
  • 251
  • 387
11
votes
2 answers

Under what conditions are HTTP request headers removed by proxies?

I'm looking at various methods of RESTfully versioning APIs, and there are three major contenders. I believe I've all but settled on using X-API-Version. Putting that debate aside, one of the arguments against using that header, and custom headers…
wprl
  • 24,489
  • 11
  • 55
  • 70
11
votes
5 answers

How to check if a box fits into another box (any rotations allowed)

Suppose I have two boxes (each of them is a rectangular cuboid, aka rectangular parallelepiped). I need to write a function that decides if the box with dimensions (a, b, c) can fit into the box with dimensions (A, B, C), assuming any rotations by…
11
votes
3 answers

Is there an algorithm better than O(N²) to determine if matrix is symmetric?

Algorithm requirements Input is an arbitrary square matrix M of size N×N, which just fits in memory. The algorithm's output must be true if M[i,j] = M[j,i] for all j≠i, false otherwise. Obvious solutions Check if the transpose equals the matrix…
Rody Oldenhuis
  • 37,726
  • 7
  • 50
  • 96
11
votes
3 answers

Is there a difference between 'data structure' and 'data type'?

Two of the questions that often come up in the Uni exam, where I study, are: Define data types. Classify and explain datatypes Define data structures. Classify and explain data structures Somehow, aren't they the same thing ? Consider that you…
An SO User
  • 24,612
  • 35
  • 133
  • 221
11
votes
4 answers

algorithm for getting time zone from geo coordinates

I want to write app where user can point any place on map (not only cities) and get timezone in that place. What data structure (app will not have Internet connectivity) and algorithm should I use? Where I can obtain needed data (I wont more…
Maciek Sawicki
  • 6,717
  • 9
  • 34
  • 48