Hi,
Imagine you have a canvas and in this canvas there are already some objects. How can you find the minimal way to cover the "uncovered" area with squares, not overlaying each other, completely filling the canvas.
In my case the "canvas" is a html-div container and the objects are nested div-containers.
Could look like this: http://...
I need to print some data (a little bit strange formatted). I was writing it in PHP with if ($num%10==9) but it was impossible for me to get correct output.
So take a look at this for example.
We have x of files in folder. For this example x=36. X is always known.
Output should look like this:
01
02
03
04
05
06
07
08
09
0a
0b
0c
0d
0e...
A project I'm working on involves 3 distinct systems/platforms. C#, Java, and XSLT. I have some simple algorithms (just a bunch of conditionals), expressed in pseudo-code as something like:
if inputParameter1 is equal to 1
return "one"
else if inputParameter2 is equal to 5
return "five" concatenated with inputParameter1
els...
I recently wrote a short algorithm to calculate happy numbers in python. The program allows you to pick an upper bound and it will determine all the happy numbers below it. For a speed comparison I decided to make the most direct translation of the algorithm I knew of from python to c++.
Surprisingly, the c++ version runs significantly...
I have been using a floodfill algorithm of the stack-based non-recursive variety and it seems to work perfectly except for one annoying situation: if use a line to cut an image in half and then floodfill one half, it floods the whole image! This only happens, however, when I do not put 'borders' around the image. If i draw a rectangle th...
I am currently writing a control (in C#) for displaying a set of tables and the relationships that exist between them. I got the basic control done, but would like to implement something similar to the "Auto-Arrange" feature provided by the diagramming component of SQL Express.
What kind of algorithm does it follow to identify the opti...
Hey folks,
I'm trying to figure out an algorithm that will help me group an assortment of files of varying sizes into say, 'n' groups of approximately equal size.
Any ideas on how to achieve this?
...
UPDATE: I managed to re-work my code from scratch, and here is what I came up with. It works, but the only problem is speed. Is there any way that I can speed up my current set up using better memory management? If so, what would be the best approach?
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
void pri...
Upon reaching a brick wall with the .Net framework's lack of a BigInteger class (yet), I've decided I'd like to develop my own as an exercise (I realize open source alternatives exist). What hoops do I need to jump through to be able to develop this? Is there any particuliar knowledge pieces that I probably wouldn't have?
edit: side q...
Say I have a binary tree with the following definition for a node.
struct node
{
int key1 ;
int key2 ;
}
The binary search tree is created on the basis of key1. Now is it possible to rearrange the binary search tree on basis of key2 in O(1) space. Although I can do this in variable space using an array of pointers to nodes.
The act...
How would one identify what algorithm is used to generate codes with? Both common, open source ones, and the more difficult, custom unpublished algorithms? For example here are a sample...
x3vbhzcouy
g3zy453f4
srix1gtvri
3ewnubic5vz
4bu9ksba6yj
r1u3rxfd82n
fs30bew9eq
b8gr8w5f3
tz6t998ulr
ycd1zued
oizyviwv
7w6eownv0
s15zxpid9uoo
u8is4ulx...
This is one of those, " I wish I had listened better, retained more of my math class info..", questions. I did this with brute force, but I know there's a better more correct way of accomplishing this.
Given a 4 x 4 array of stations, and 8 groups(a-h). How to fill the array with group pair combinations so each pair(ab, ba) occurs only ...
How can I calculate the average of a set of data while smoothing over any points that are outside the "norm". It's been a while since I had to do any real math, but I'm sure I learned this somewhere...
Lets say I have 12 days of sales data on one item: 2,2,2,50,10,15,9,6,2,0,2,1
I would like to calculate the average sales per day with...
Hi,
I was wondering if someone could point me to an algorithm/technique that is used to compare time dependent signals. Ideally, this hypothetical algorithm would take in 2 signals as inputs and return a number that would be the percentage similarity between the signals (0 being that the 2 signals are statistically unrelated and 1 being...
Due to the wonders of branch prediction, a binary search can be slower than a linear search through an array of integers. On a typical desktop processor, how big does that array have to get before it would be better to use a binary search? Assume the structure will be used for many lookups.
...
I am fetching some questions from the server (database) and showing it to client (user) in the browser. The client will answer the question and based on his/her answer the next set of questions will be fetched from the database. Now, I want to pre-fetch the next set of questions while the user read the present question so that the waitin...
What are the main algorithms used in RDMBS ?
...
Update:
A entity is an object created with attributes/methods of a given entity template. A entity may have a parent and/or a number of children.
Every entity template has a thread fragmentation cost and a computer fragmentation cost. They define how costly it will be to have children of that entity on different computers/thread from t...
To compare byte by byte surely works. But I am wondering if there are any other proven way, say some kind of hashing that outputs unique values for each file. And if there are, what are the advantages and disadvantage of each one in terms of time and memory footprint.
By the way, I found this previous thread http://stackoverflow.com/q...
I've a good idea of what Big-O is, and I also know a few basic sorting algorithms, although, for some reason, I was never comfortable with them, and I keep forgetting them. I've been programming for 4 years in Java, Python, C and C++; I've been a decent programmer. Now, I want to move beyond learning programming languages and start learn...