## 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 are ma

## Get the most likely color from a set of words

Are there any libraries existing or methods that let you to figure out the most probable color for a words set? For example, cucumber, apple, grass, it gives me green color. Did anyone work in that direction before?If i have to do that, i will try to

## Divide the collection into new tables as well.

I'm trying to create an method to evenly distribute an array into X numbers of new arrays, where there is only allowed 15 items pr array, and you are only allowed to create a new array, if the previous have 10 items, except if the array has less than

## Find all paths with cycles in the oriented graph, given the source vertex

I'm having trouble solving this problem. I have to find all simple paths starting from a source vertex s containing a simple cycle in a directed graph. i.e. No repeats allowed, except of course for the single repeated vertex where the cycle joins bac

## Generate hills of different heights and widths like Tiny Wings?

How can I generate rolling hills of different height and width like Tiny Wings? Right now I'm using sin() but it obviously generates uniform hills repeating forever and ever. What's the secret? Thanks!Certainly not a procedural generation expert - bu

## How can I approximate & ldquo; Did you mean? & Rdquo; without using Google?

I am aware of the duplicates of this question: How does the Google "Did you mean?" Algorithm work? How do you implement a "Did you mean"? ... and many others. These questions are interested in how the algorithm actually works. My quest

## What is a data structure that quickly supports the next-higher-element and next-lower-element elements?

Specifically I want O(log n) insertion/deletion times and O(1) operation for find_next_higher_element which given an element in the data structure returns the element just greater than it in constant time. I don't know if this is even possible but my

## How do language links work?

How do language bindings work? For instance how would one make bindings from a library written in one language to another language? Would the bindings be written in the same language as the library or the language the bindings are for? Is it possible

## How can I keep a part of a sensitive application when the other parts are not?

I use RDP sessions a lot, and I noticed that, even if the server I connect to is slow or crashed, the RDP window/toolbar itself is fully responsive/clickable. This is probably due to the RDP window is one process and the actual server is seperate - o

## Involuntary encryption (such as ROT13) for an alphabet with an odd number of symbols

ROT13 has the nice property of being an involution for an A-Z alphabet (26 letters), that is to say: ROT13(ROT13(string-A-to-Z)) = string-A-to-Z ; What is a simple cipher function for an alphabet with an odd number of symbols that has the same proper

## Do you throw an exception when you know that the method you are calling would do the same thing?

Say I have a method like this*: public T GetItem(int index) { if (index < 0 || index >= _privateList.Count) { throw new ArgumentOutOfRangeException("index"); } return _privateList[index]; } Would you include that throw or leave it out? On

## Algorithm to determine if 2 graphs are isomorphic

Disclaimer: I'm a total newbie at graph theory and I'm not sure if this belongs on SO, Math SE, etc. Given 2 adjacency matrices A and B, how can I determine if A and B are isomorphic. For example, A and B which are not isomorphic and C and D which ar

## Is not the composition bad for testability?

Typically Composition and Aggregation are treated the same? But they are different and the choice which one to use changes a lot? For e.g: I believe aggregation would be ideal for testing. But composition is not. Maintenance of dependencies is a pain

## The most effective way to calculate a series of moves in solitary peg

Given an arbitary peg solitaire board configuration, what is the most effecient way to compute any series of moves that results in the "end game" position. For example, the standard starting position is: ..***.. ..***.. ******* ***O*** ******* .

## How does this entire encoding work?

In this code golf question, there is a python answer that encodes the lengths of all integers from 1 to 99 in english to a big number: 7886778663788677866389978897746775667552677566755267756675527886778663788677866355644553301220112001 To get the len

## Are there any non-obvious ways to misuse GUIDe?

GUIDs are typically used for uniquely identifying all kinds of entities - requests from external systems, files, whatever. Work like magic - you call a "GiveMeGuid()" (UuidCreate() on Windows) function - and a fresh new GUID is here at your serv

## How to display the browser's local time in a web application

I am writing a web app and I would like to display timestamps on the page in the user's localtime. There seems to be several ways to do this but it is not obvious what is a good way. Use geolocation from the IP address to get the timezone - This seem

## Playing with infinity - lazy arithmetic

Many modern programming languages allow us to handle potentially infinite lists and to perform certain operations on them. Example [Python]: EvenSquareNumbers = ( x * x for x in naturals() if x mod 2 == 0 ) Such lists can exist because only elements

## How do I consistently choose each value of m from a table, when m is a decimal?

Lets say I have an array of length n and I want to pick k values from it, evenly, starting from 0. If k divides n, then this would be easy, but if k does not divide n, then I need to vary the value m I increment the array pointer with. How would you

## View compiler warnings

I'm looking for a way to visualize compiler warnings and remarks, by annotating or otherwise showing which lines cause a report. This is much like a modern IDE like NetBeans or Eclipse already does, but I'd like to take output from several compilers

## How to avoid blockages?

When using multiple threads, shared memory needs to be locked by critical sections. However, using critical sections causes potential deadlocks. How can they be avoided?One way is to use a hierarchy of critical sections. If you ensure that a parent c

## Where to start programming?

Once you have your first set of requirements and design done where do you start programming? (Assume tests will be written in the same order, but before the code). The entry point Framework/Support classes Entity Classes Easiest thing first Hardest t

## How to preserve the building environment during the product lifecycle

What are best practices in recording build/test machine(s) setup during the life time of a project? If you need to provide a patch for previous version of your product, you likely need to reload the same compiler and support tools to re-issue the pat

## The fastest way to find the most similar channel to an entry?

Given a query string Q of length N, and a list L of M sequences of length exactly N, what is the most efficient algorithm to find the string in L with the fewest mismatch positions to Q? For example: Q = "ABCDEFG"; L = ["ABCCEFG", &quo

## Flexible, robust and portable discovery of services

I am looking for a way for clients in a LAN to find all the instances of my server application without any configuration. Instead of hacking something myself, I'd like to use an existing solution. Personally, I need it to be done in Python, but I'd h

## How do you check if a domain name exists?

Not only easy ones like .com or .net, but also, .co.uk, .fr, .gov.rw ... ? Should I really make a huge mapping "tld to relevant whois server", or is there an easier way ?http://php.net/manual/en/function.checkdnsrr.php if (checkdnsrr('test.nl',

## Agnostic Language Construction Management System

Several times in my career, I have worked in a software group that determined that a) We needed a build/test system b) We should write our own c) We can have a developer spend a week, get it done and they shouldn't have to touch it again Every time,

## The first two uppercase characters of a column in a db table

I've got a column in a database table (SQL Server 2005) that contains data like this: TQ7394 SZ910284 T r1534 su8472 I would like to update this column so that the first two characters are uppercase. I would also like to remove any spaces between the

## What are the common file extensions for Web programming languages?

What file extensions are used most commonly by different languages? Please don't put source file names (like .java) but rather extensions that would be present in a URL for rendered pages. Here is my (alphabetized) list so far ASP Classic asp ASP.NET

## Golf Code: Four is magic

The puzzle A little puzzle I heard while I was in high school went something like this... The questioner would ask me to give him a number; On hearing the number, the questioner would do some sort of transformation on it repeatedly (for example, he m