I want to analyze a message's type for best performance, the message is begin with constant string and one space followed. The constant strings belongs to one known list of string array, like "CUT", "GET", "LOGIN" ...
So I do not like to memcmp(data, "GET", 3) thing repeatedly which is bad for performance. I wonder is there any better ...
I am trying to find references about different designs of metamorphic generators can someone point me to the right direction. I have gone through some papers in ACM but couldn't find what I am looking for.
...
I came across this document Binary Search Revisited where the authors have proved/explained that binary search can be used for unsorted arrays (lists) as well. I haven't grokked much of the document on a first reading.
Have any of you already explored this ?
...
Hello.
I'm working on Markov Chains and I would like to know of efficient algorithms for constructing probabilistic transition matrices (of order n), given a text file as input.
I am not after one algorithm, but I'd rather like to build a list of such algorithms. Papers on such algorithms are also more than welcome, as any tips on ter...
I am trying to compare two byte arrays in memory and produce a data structure to hold the differences so that with byte array B and the data structure holding the differences it is possible to recreate byte array A.
The size of the byte arrays are always identical and are relatively small. The byte arrays represent bitmaps which typica...
I once read a problem in my Introduction to Algorithms (MIT Press) book which stated.
We have a book with 100 pages and each page has a weight associated with it equal to its page number therefore the weights are i.e. 1,2,3,4,5. These weights represent the difficulty of the page in translation to other language. We have K people assigne...
I know there are some like:
Bubble sort
Insertion sort
Shell sort
Merge sort
Heapsort
Quicksort
Bucket sort
Radix sort
Distribution sort
Shuffle sort
And there are some impractical ones like:
Bogosort
RandomSort
Some of the above use comparisons and others do not.
Do you know which other Efficient Algorithms or Techniques ...
Hello,
To begin with, this question is not a dup of this one, but builds on it.
Taking the tree in that question as an example,
1
/ \
2 3
/ / \
4 5 6
How would you modify your program to print it so,
1
2 3
4 5 6
rather than the general
1
2
3
4
5
6
I'm basically looking for intuitions on the most efficie...
I wasn't sure what to call this. I'm building a tile based game where the user can click on a tile.
it is a 2d c++ vector of tiles. right now I have an algorithm that positions them like this:
[][][][][][][][][][][]
[][][][][][][][][][][]
[][][][][][][][][][][]
[][][][][][][][][][][]
[][][][][][][][][][][]
[][][][][][][][][][][]
they ...
I find the algorithm description in AIMA (Artificial Intelligence: A Modern Approach) is not correct at all. What does 'necessary' mean? What is the memory limit? The queue size or processed nodes? What if the current node has no children at all?
I am wondering if this algorithm itself is correct or not. Because I searched the Internet ...
I just wrote this exam, in which there was question: Consider a array of size 2n, where the numbers in odd positions are sorted in ascending order and the the numbers in even positions in descending order. Now, if I have to search for a number in this array, which is a good way to do this? The options were:
Quick sort and then binary s...
I'm trying to understand the algorithm described here, but the explanation really isn't very clear:
'tour' is a stack
find_tour(u):
for each edge e=(u,v) in E:
remove e from E
find_tour(v)
prepend u to tour
to find the tour, clear stack 'tour' and call find_tour(u),
where u is any vertex with a non-zero degree.
Wha...
I'm making a tile game in c++. Right now when the game loads all the tiles place themselves based on:
tilesize -> they are squares so this is width and height
tile_count_x
tile_count_y
I have the following variables:
desktop_width
desktop_height
game_window_width
game_window_height
tile_count_x
tile_count_y
Based on these valu...
I need an algorithm for returning the successor node of some arbitrary node of the
given binary search tree.
...
I have a large collection of rectangles, all of the same size. I am generating random points that should not fall in these rectangles, so what I wish to do is test if the generated point lies in one of the rectangles, and if it does, generate a new point.
Using R-trees seem to work, but they are really meant for rectangles and not point...
We're writing a very simple program to execute on a processor we've built for a class. It doesn't have the capability to multiply or divide. We do however, had support for addition, subtraction, and, or, and branching for loop control (like branch on equal if you are familiar with MIPS). We were thinking a neat program to run on it would...
My Java program saves its data to a binary file, and (very) occasionally the file becomes corrupt due to a hardware fault. Usually only a few bytes are affected in a file that is several megabytes in size. To cope with this problem, I could write the data twice, but this seems overkill - I would prefer to limit the file size increase ...
I have a class of interest (call it X).
I have a std::list<X*> (call it L).
I have a function (call it F).
F(L) returns a subset of L (a std::list<X*>) according to an algorithm that examines the internal state of each X in the list.
I'm adding to my application a std::map<int,X*> (call it M), and I need to define F(M) to operate in ...
What is the difference between Foward-backward algorithm on n-gram model and viterbi algorithm on HMM model?
When I review the implementation of these two algorithms, only thing I found is that the transaction probability is coming from different probabilistic models.
Is there a difference between these 2 algorithms?
...
I have to generate all variations without repetitions made of digits 0 - 9.
Length of them could be from 1 to 10. I really don't know how to solve it, especially how to avoid repetitions.
Example:
length of variations: 4
random variations: 9856, 8753, 1243, 1234 etc. (but not 9985 - contains repetition)
I would be really gratefu...