language-agnostic

Does this data structure have a name? Sort of a "linked matrix"?

Let's say I wanted similar functionality to a doubly linked list but needed a matrix instead so that each node was structured like this: public class Node { Node Up, Down, Left, Right; object Value; } Is there a name for such a structure? I've looked through this Wikipedia listing of data structures but didn't see anything sim...

When can "creating" and "declaring" be used synonymously?

Once in a while you stumble over a technical article where "creating" and "declaring" are used synonymously. E.g. declares an array of ints creates an array of ints But aren't declaring and creating two different things? Or does it depend on the context? ...

Good books and resources on user interface testing

I am looking for good books and articles on user-interface testing. What they should contain (one or more of): different test methods/strategies examples, use cases naming pros and cons for different methods testing functionality testing usability (less important for my me but still good) something important I might have forgotten :-) ...

Minimizing the number of boxes that cover a given set of intervals

Hi, this is a question for the algorithms gurus out there :-) Let S be a set of intervals of the natural numbers that might overlap and b a box size. Assume that for each interval, the range is strictly less than b. I want to find the minimum set of intervals of size b (let's call it M) so all the intervals in S are contained in the in...

How to balance number of ratings versus the ratings themselves?

Hello guys, For a school project, we'll have to implement a ranking system. However, we figured that a dumb rank average would suck: something that one user ranked 5 stars would have a better average that something 188 users ranked 4 stars, and that's just stupid. So I'm wondering if any of you have an example algorithm of "smart" rank...

What is a Windows scripting language that: does not rely on .NET and offers the most OOP support and has simplest deployment?

What is a Windows scripting language that: does not rely on .NET and offers the most OOP support and has simplest deployment? It doesn't necessarily need to be a scripting language; It can be in the form of a compiled executable, however it needs to be self contained--only ONE file, no DLL's and it cannot be declared to "include" other ...

Why should I use code generators

I have encountered this topic lately and couldn't understand why they are needed. Can you explain why I should use them in my projects and how they can ease my life. Examples will be great, and where from I can learn this topic little more. ...

How do they make programs that run on startup

Programs like page defrag by sysinternals or the chkdsk utility that run on startup. Please enlighten me. What kind of programming language do they use for these kinds of operations. ...

When is performance gain significant enough to implement that optimization?

Hi, following the text book, I do measure performance whenever I try optimizing my code. Sometimes, however, the performance gain is rather small and I can't decisively decide whether I should implement that optimization. For example, when a fix shortens an average response time of 100ms to 90ms under some conditions, should I impleme...

Number of different elements in an array.

Is it possible to compute the number of different elements in an array in linear time and constant space? Let us say it's an array of long integers, and you can not allocate an array of length sizeof(long). P.S. Not homework, just curious. I've got a book that sort of implies that it is possible. ...

Tutorial or book for fantasy sport app design

There are a lot of sites out there that have online fantasy applications. There is also a lot of design that goes into making one of these sites. Does anyone know of a good tutorial or book that covers the basics and gives readers suggestions on how to handle major design patterns. As I work through trying to make one of these apps ...

Is there a way to formerly define a time interval for configuring a process?

Horribly worded question...I know. I'm working on an application that processes data for the previous day. The problem is that I know the customer is going to eventually ask to it for every hour or some other arbitrary time interval. I know that languages such as Java or SQL have masks for defining dates. Well what about a way to def...

given two bits in a set of four, find position of two other bits

hello I am working on a simple combinatorics part, and found that I need to recover position of two bits given position of other two bits in 4-bits srring. for example, (0,1) maps to (2,3), (0,2) to (1,3), etc. for a total of six combinations. My solution is to test bits using four nested ternary operators: ab is a four bit string, wi...

Is it considered bad form to execute a function within a conditional statement?

Consider a situation in which you need to call successive routines and stop as soon as one returns a value that could be evaluated as positive (true, object, 1, str(1)). It's very tempting to do this: if (fruit = getOrange()) elseif (fruit = getApple()) elseif (fruit = getMango()) else fruit = new Banana(); return fruit; I like it,...

What is a typical algorithm for finding a string within a string?

I recently had an interview question that went something like this: Given a large string (haystack), find a substring (needle)? I was a little stumped to come up with a decent solution. What is the best way to approach this that doesn't have a poor time complexity? ...

Is a red-black tree my ideal data structure?

I have a collection of items (big rationals) that I'll be processing. In each case, processing will consist of removing the smallest item in the collection, doing some work, and then adding 0-2 new items (which will always be larger than the removed item). The collection will be initialised with one item, and work will continue until it ...

Which term to use when referring to functional data structures: persistent or immutable?

In the context of functional programming which is the correct term to use: persistent or immutable? When I Google "immutable data structures" I get a Wikipedia link to an article on "Persistent data structure" which even goes on to say: such data structures are effectively immutable Which further confuses things for me. Do functi...

Interface for classes that have nothing in common

Lets say I want to make few classes to determine behaviour of agents. The good practice would be to make some common interface for them, such interface (simplified) could look like this: interface IModel { void UpdateBehaviour(); } All , or at least most, of such model would have some parameters, but parameters from one model mig...

Have you been in cases where TDD increased development time?

Hello everyone :) I was reading http://stackoverflow.com/questions/2512504/tdd-how-to-start-really-thinking-tdd and I noticed many of the answers indicate that tests + application should take less time than just writing the application. In my experience, this is not true. My problem though is that some 90% of the code I write has a TON ...

To Throw or Not to Throw

// // To Throw void PrintType(object obj) { if(obj == null) { throw new ArgumentNullException("obj") } Console.WriteLine(obj.GetType().Name); } // // Not to Throw void PrintType(object obj) { if(obj != null) { Console.WriteLine(obj.GetType().Name); } } What principle to keep? Personal...