theory

Calculate volume based on STL file

Just wondering if anyone had a simple, efficient way of calculating the volume of a stereolithographic file (STL)? And rendering this in a Windows Form Control? ...

Can Haskell's Parsec library be used to implement a recursive descent parser with backup?

I've been considering using Haskell's Parsec parsing library to parse a subset of Java as a recursive descent parser as an alternative to more traditional parser-generator solutions like Happy. Parsec seems very easy to use, and parse speed is definitely not a factor for me. I'm wondering, though, if it's possible to implement "backup" w...

What is the use of reflection in Java/C# etc

I was just curious, why should we use reflection in the first place? // Without reflection Foo foo = new Foo(); foo.hello(); // With reflection Class cls = Class.forName("Foo"); Object foo = cls.newInstance(); Method method = cls.getMethod("hello", null); method.invoke(foo, null); We can simply create an object and call the class's m...

A Turing Machine Question

Greetings, I have been struggling to find a question regarding this theoretical question, even tho it is not directly a programming question, I believe it is really related. Assume a type of Turing machine which cannot have more than 1000 squares. What would be the relationship between the set of such type of recognizable languages an...

Good books for learning advanced network topics (eg VOIP, MPLS, VPN, QoS) ?

Not sure if this is an appropriate question as it isn't directly programming related, but since understanding those is sometimes necessary for programmers, I believe it is a valid question, so I'm posting it. Anyway, I want to learn some of the more advanced topics that you normally don't find in introductory network books, such as the ...

The limits of parallelism (job-interview question)

Is it possible to solve a problem of O(n!) complexity within a reasonable time given infinite number of processing units and infinite space? The typical example of O(n!) problem is brute-force search: trying all permutations (ordered combinations). ...

Purpose of singletons in programming

This is admittedly a rather loose question. My current understanding of singletons is that they are a class that you set up in such a way that only one instance is ever created. This sounds a lot like a static class to me. The main differnce being that with a static class you don't / can't instance it, you just use it such as Math.pi()....

Do btrees and b+trees only store data at the leafs?

Do b trees and b+ trees only store data at their leafs? I am assuming that they use their internal nodes to search the required data. Is that the case or do they store data in every node? ...

Difference between B Trees and 2-3-4 Trees

Hi, Could someone please explain to me the difference between B Trees and 2-3-4 Trees? And also how would you find the maximum and minimum height of each? Thanks ...

Object responsibilities - list and item

My question is more like a theoretical. Say you have an object, that represents the list of something (articles, pages, accounts etc.) class ObjCollection You have a class, that represents a specific item in collection: class objItem I have a problem thinking of a basic responsibilities of each object. Which class is responsible...

circles and triangles problem

Hello everyone, I have an interesting problem here I've been trying to solve for the last little while: I have 3 circles on a 2D xy plane, each with the same known radius. I know the coordinates of each of the three centers (they are arbitrary and can be anywhere). What is the largest triangle that can be drawn such that each vertic...

Context Free Language Question (Pumping Lemma)

I know this isn't directly related to programming, but I was wondering if anyone know how to apply the pumping lemma to the following proof: Show that L={(a^n)(b^n)(c^m) : n!=m} is not a context free language I'm pretty confident with applying pumping lemmas, but this one is really irking me. What do you think? ...

Can an algorithmic process ever give true random numbers ?

Possible Duplicate: True random number generator I have worked with random functions in python,ruby, MATLAB, Bash and Java. Nearly every programming language has a function to generate random numbers. However, these apparently random sequences are termed as pseudo-random number sequences as the generation follows a determinis...

Shift-reduce: when to stop reducing?

I'm trying to learn about shift-reduce parsing. Suppose we have the following grammar, using recursive rules that enforce order of operations, inspired by the ANSI C Yacc grammar: S: A; P : NUMBER | '(' S ')' ; M : P | M '*' P | M '/' P ; A : M | A '+' M | A '-' M ; And we want to parse ...

integer division properties

hi. does the following integer arithmetic property hold? (m/n)/l == m/(n*l) At first I thought I knew answer (does not hold), but now am not sure. Does it hold for all numbers or only for certain conditions, i.e. n > l? the question pertains to computer arithmetic, namely q = n/m, q*m != n, ignoring overflow. ...

B+ tree node sizing

I'm planning on writing a simple key/value store with a file architecture similar to CouchDB, i.e. an append-only b+tree. I've read everything I can find on B+trees and also everything I can find on CouchDB's internals, but I haven't had time to work my way through the source code (being in a very different language makes it a special p...

How to randomize a sorted list?

Here's a strange question for you guys, I have a nice sorted list that I wish to randomize. How would i go about doing that? In my application, i have a function that returns a list of points that describe the outline of a discretized object. Due to the way the problem is solved, the function returns a nice ordered list. i have a secon...

Is a server an infinite loop running as a background process?

Is a server essentially a background process running an infinite loop listening on a port? For example: while(1){ command = read(127.0.0.1:xxxx); if(command){ execute(command); } } When I say server, I obviously am not referring to a physical server (computer). I am referring to a MySQL server, or Apache, etc. Full di...

Basics of automated tests?

Hi, Till now I've been testing my web (usually written in PHP) as well as desktop applications (normally Java or C#) manually. Now I read somewhere on the net about automated tests. I tried searching to know about it in details but almost all searches end up at things like PHPUnit. Could someone please put some light on the theory behind...

What areas of computer science are particularly relevant to mobile development?

This isn't a platform specific question - rather I'm interested in the general platform independent areas of computer science that are particularly relevant to mobile applications development. For example, things like compression techniques, distributed synchronisation algorithims etc.. what theoretical concepts have you found relevant,...