I need to create a map of a building.
The area is a convex polygon that has several non-overlapping
convex holes.
As a simplification, the area can also be expressed as a rectangle.
The holes can also be modelled as rectangles.
I first tried to handle it with GEOS, a C++ library that comes
with a low level C API. But it seemed that GEOS...
Hello people. Here is the CASE
I have an sql table consisting of just one data column, consisting of some group names. Here how the table looks:
OPEN SYSTEMS SUB GR
OPEN SYSTEMS SUB GR (GM/BTIB(1111)/BTITDBL(2222)/BTVY(4444)/ACSVTYSAG
INFRASTRUCTURE SOFT SUB GR
INFRASTRUCTURE SOFT SUB GR (GM/BTIB(1111)/BTUGBL(3333)/BTUGBL(3333)/BTAUS...
After requesting some user pictures, I end up with an array like this:
[
{ label: "portrait", owner: "Jon" },
{ label: "house", owner: "Jim" },
{ label: "portrait", owner: "Jim" },
{ label: "portrait", owner: "Jane" },
{ label: "cat", owner: "Jane" }
]
I need to highlight items whose label occurs multiple times in ...
I am puzzled with the following simple problem:
Given positive integers b, c, m where (b < m) is True it is to find a positive integer e such that
(b**e % m == c) is True
where ** is exponentiation (e.g. in Ruby, Python or ^ in some other languages) and % is modulo operation. What is the most effective algorithm (with the lowest big-...
There are four stacks. On the first stack there are n numbers 1, 2, ... n in random order. The other three stacks are empty. The goal is to determine, given the state of the first stack, whether is it possible to move all the elements to the last stack so that they are sorted. Allowed moves are moving the element from the first stack to ...
I'm designing a 3D game with a camera not entirely unlike that in The Sims and I want to prevent the player character from being hidden behind objects, including walls, pillars and other objects.
One easy way to handle the walls case is to have them face inwards and not have an other side, but that won't cover the other cases at all.
W...
I'm writing a small software application that needs to serve as a simple planning tool for a local school. The 'problem' it needs to solve is fairly basic. Namely, the teachers need to talk with the parents of all children. However, some children have, of course, brothers and sisters in different groups, so these talks need to be schedul...
Looking at this:
MENU_ITEM_BACK#0="Back";
MENU_ITEM_BLOCK_CHANNEL#0="Block";
MENU_ITEM_CLOSE#0="Close";
MENU_ITEM_DETAILS#0="Details";
MENU_ITEM_DIAGNOSE#0="Diagnose";
MENU_ITEM_DOWNLOAD#0="Download";
...and so on (over 500 lines). What would be the best way to automate copying the label name into the label itself. For example,
MENU...
I am developing an application that provides contextual knowledge lookup. The application is in its design phase.
I need to know whether a simple graph structure and a traversal algorithm would be sufficient or whether I should go with a neural network. I want to go with the most long-term solution.
I am thinking of representing indivi...
Cheers,
I know you can get the amount of combinations with the following formula (without repetition and order is not important):
// Choose r from n
n! / r!(n - r)!
However, I don't know how to implement this with C++, since for instance with
n = 52
n! = 8,0658175170943878571660636856404e+67
the number gets way too big even for un...
Their goals are all the same: to find similar vectors.
Which do you use in which situation? (any practical examples?)
...
Hello, I'm back with another similar question. I am currently working on a Java program that will check if a graph is 2-colorable, i.e. if it contains no odd cycles (cycles of odd number length). The entire algorithm is supposed to run in O(V+E) time (V being all vertices and E being all edges in the graph). My current algorithm does a D...
I am developing an algorithm with Postgres (PL/PgSQL), and I need to calculate the number of working hours between 2 dates, taking into account that weekends are not working and the rest of the days are counted only from 8am to 15pm.
Examples:
From Dec 3rd at 14pm to Dec 4th at
9am should count 2 hours. (3rd = 1, 4th = 1)
From Dec 3rd...
I would like to know if there is an efficient algorithm S = F(v,G) to construct a subgraph S out of a DAG G = (V,E) such that all the paths in S contain the vertex v of V. If so, it is possible to efficiently extend F to F'(N,G) for a set of vertices N. I am open to any data structures for storing the DAG G initially.
Actually a condit...
Suppose I want to match address records (or person names or whatever) against each other to merge records that are most likely referring to the same address. Basically, I guess I would like to calculate some kind of correlation between the text values and merge the records if this value is over a certain threshold.
Example:
"West Lawnm...
Given an array of true/false values, what is the most efficient algorithm to select an index with a true value at random.
A sketch simple algorithm is
a <- the array
c <- 0
for i in a:
if a[i] is true: c++
e <- random number in (0, c-1)
j <- 0
for i in e:
while j is false: j++
return j
Can anyone come up with a faster algor...
I'm attempting to create pretty large bitmaps in a C# application (6000x6000, though most is transparent) and need to draw them to a specific output API which only supports drawing rectangles.
Now, I'm wondering if anyone has an algorithm to reduce a bitmap to a series of filled rectangles of similarly-colored bitmaps; since drawing eve...
Out of curiosity, I was checking out the problem set to the 2009 ACM international collegiate programming contest. The questions are pretty interesting. They're available at http://cm.baylor.edu/resources/pdf/2009Problems.pdf. I could not come up with an algorithm that solved problem 1, which I will reproduce here. It set off a livel...
I need a technique (an a pointer to sample code if you have) for generating conformation numbers for web payment. I don't want the customer to write down a long sequence like a GUID but I don't want it easily predictable as well.
Using C#
Thanks for all the tips.
I decided on a format like this:
TdddRROOO
T = 2009 (next year will be ...
How does one go about doing doubly linked lists in a pure functional language? That is, something like Haskell where you're not in a Monad so you don't have mutation. Is it possible? (Singly linked list is obviously pretty easy).
...