Hi, im working in a simple graphical library in C with turbo C++ because im developing a very primitive version of a paint style program, everyting works well but i can´t get the flood fill algorithm to work. Im using the 4 way flood fill algorithm, first i tried with the recursive version but it only work with small areas, filling large...
i have an array like this:
1,2,3,5,6,4
it is 99% sorted and has 40K elements.
i can put them in an array, list, linked list, ...
but i don`t know the fastest way to sort them!
...
Say I got a set of 10 random numbers between 0 and 100.
An operator gives me also a random number between 0 and 100.
Then I got to find the number in the set that is the closest from the number the operator gave me.
example
set = {1,10,34,39,69,89,94,96,98,100}
operator number = 45
return = 39
And how do translate this into code? (...
We've all poked fun at the 'X minutes remaining' dialog which seems to be too simplistic, but how can we improve it?
Effectively, the input is the set of download speeds up to the current time, and we need to use this to estimate the completion time, perhaps with an indication of certainty, like '20-25 mins remaining' using some Y% con...
I want to convert a Character to a 7 bit even parity. Can you please suggest me, how to implement this?
...
Hi, I am developing a game that calls so many math functions for physics and rendering. "Fast inverse sqrt" used in Quake3 is known to be faster than sqrt() and its background is beautiful.
Do you know any other algorithm that is faster than usual one with acceptable accuracy loss?
...
An open source high-performance project I'm working on needs to keep a cache of parsed/compiled files. A plain LRU or a plain LFU wouldn't fit. Plain LRU wouldn't work as there will be remote batch/spider processes hitting the service regularly. Plain LFU wouldn't work because content will age. ARC seems like the perfect solution but sin...
Hello,
I need to write an essay or a research for the subject Artificial Intelligence. There are many possible topics I can choose from plus we are also allowed to write about any other topic of interest.
One of the topics is Semantic Web. I would like to write about use of AI algorithms in relation with Semantic Web.
Could you please...
Hello,
I'm looking for an algorithm that takes as arguments two strings, source and destination, and returns the steps required to transform the source string to the destination. Something that takes Levenshtein distance one step farther.
E.g.,
Input: source "abc", dest "abbc"
Output: insert 'b' at position 1 in source
Input: source...
I have an unsorted array (of generated die rolls), and I want to select the top N elements of it (which is trivial with sort-and-snip), but mark them while keeping them in order.
E.g.:
mark([1,2,3,4], 3) ==> [[1, false], [2, true], [3, true], [4, true]]
mark([3,5,2,6,2], 3) ==> [[3, true], [5, true], [2, false], [6, true], [2, false]]...
The problem seems simple at first: just assign an id and represent that in binary.
The issue arises because the user is capable of changing as many 0 bits to a 1 bit. To clarify, the hash could go from 0011 to 0111 or 1111 but never 1010. Each bit has an equal chance of being changed and is independent of other changes.
What would you...
L->|
A -> B ^ |
|__> C -> D-> G->X--| |
K |_> T | |_>Z
|___________|
I hope this small drawing helps convey what I'm trying to do.
I have a list of 7,000 locations, each with an undefined, but small number of doors. Each door is a bridge between both locations.
Referencing t...
Support we have an n * m table, and two players play this game. They rule out cells in turn. A player can choose a cell (i, j) and rule out all the cells from (i,j) to (n, m), and who rules out the last cell loses the game.
For example, on a 3*5 board, player 1 rules out cell (3,3) to (3,5), and player 2 rules out (2,5) to (3,5), curre...
I have several regexes (actually several thousands), and I must check if one string matches any of these regexes. It is not very efficient, so I would like to merge all these regexes as a single regex.
For example, if a have these regexes:
'foo *bar'
'foo *zip'
'zap *bar'
I would like to obtain something like 'foo *(bar|zip)|zap *ba...
I have a large collection of objects and I need to figure out the similarities between them.
To be exact: given two objects I can compute their dissimilarity as a number, a metric - higher values mean less similarity and 0 means the objects have identical contents. The cost of computing this number is proportional to the size of the sm...
As everybody knows there's no built-in function to remove the duplicates from an array in javascript. I've noticed this is also lacking in jQuery (which has a unique function for DOM selections only), and the most common snippet I found checks the entire array and a subset of it for each element (not very efficient I think), like:
for (...
I have an array of sorted numbers:
pts = [ 0, 4, 25, 51, 72, 100 ]
Given value T, I need to find the index of the first number in the array greater than T.
if T = 2, then the correct index is 1 for value 4
dumb solution
I can do this with a linear search, but would like to optimize.
not working solution
Binary search algorithm e...
How do you create words which are not part of the english language, but sound english? For example: janertice, bellagom
...
Why is the lower bound for the time complexity of comparison-based sort algorithms O(n log n)?
...
Could you please give at least two examples of each. Thanks.
...