Yes!
Look here there is a program:
http://groups.google.com/group/algogeeks/browse_thread/thread/11b032a28995baed/7b896ee015b090e5
On Feb 13, 3:16 am, conundrum [EMAIL PROTECTED] wrote:
Given a text and a set of keywords, is there a linear time algorithm
to find the smallest subtext containing
just store list of phone number as leaf in trie.
What abt collisions in Trie?? Like if same name then???
Still don't understand why you all so eager to use Trie, in my point
of view this is improper data structure in this case.
--~--~-~--~~~---~--~~
You
and to make a heap out of it we need
O(n) space.
heap sort will surely take constant amount of auxially space if heap is
already build.
isn't it?
correct me if i m wrong..
On 11/9/07, Andrey [EMAIL PROTECTED] wrote:
Heapsorthttp://en.wikipedia.org/wiki/Heapsort
I thought about trie first but then I've change my mind and decided
that I'd rater use a simple binary tree or even an sorted array.
As we have quite limited set of first names and surnames we can easily
index them i.e. store them in sorted array and use an index in the
array indead of the
Heapsort http://en.wikipedia.org/wiki/Heapsort#Comparison_with_other_sorts
On Nov 9, 3:54 pm, Pramod Negi [EMAIL PROTECTED] wrote:
which algo sort array in O(N lgN) without extra space??
On 11/6/07, Andrey [EMAIL PROTECTED] wrote:
dor is absolutely right
O(N*log(N
No reasons, the structure is static so sorted array is the fastest
way.
Don't know how about trie, it's hard to estimate...
On 9 нояб, 18:16, Ajinkya Kale [EMAIL PROTECTED] wrote:
How about using a Red-Black tree ?
On 11/9/07, Andrey [EMAIL PROTECTED] wrote:
I thought about trie
and then 4,5,6,7 at the right side. Look at the
solutions. How they differ? Is this natural?
Though the order is not imp you cant tell which 2 variables for a particular
equation.
On Nov 7, 6:55 pm, Andrey [EMAIL PROTECTED] wrote:
Won't work.
You just can't build such a system, because
matrix.
Inverting the matrix can let you solve the problem for many instances.
It would be interesting to exploit the special structure of this
matrix in order to speed up the computation. Please post if you find
such an improvement.
Best Regards,
Antonio
On Nov 7, 5:16 pm, Andrey [EMAIL
Any set of n integers form n(n 1)/2 sums by adding every possible
pair.
The task is to find the n integers given the set of sums.
Any ideas?
I've found out the solution but I doubt it the best one...
--~--~-~--~~~---~--~~
You received this message because you
Any set of n integers form n(n - 1)/2 sums by adding every possible
pair.
The task is to find the n integers given the set of sums.
Any ideas?
I've found out the solution but I doubt it the best one...
--~--~-~--~~~---~--~~
You received this message because you
dor is absolutely right
O(N*log(N)) is straightforward.. sort the array in O(N*log(N)) and
then remove duplicates in linear time.
it doesn't need any extra memory.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
You'd better wite a program.
On 11 окт, 10:42, Vaibhav Jain [EMAIL PROTECTED] wrote:
Algo:
1. initialize final_result array with whole sequence and count number of
keywords in no_of_keys and initialize counter array for keywords with value
zero.
2. if sequence_ptr is not null then start
You'd better write a program.
On Oct 11, 10:42 am, Vaibhav Jain [EMAIL PROTECTED] wrote:
Algo:
1. initialize final_result array with whole sequence and count number of
keywords in no_of_keys and initialize counter array for keywords with value
zero.
2. if sequence_ptr is not null then
I doubt It will be O(n^3)..
Dynamic programming algorithm, by size of submatrix, will give at
least O(N ^ 4), won't it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Does anyone knew more effective solution then DP?
On Oct 12, 3:46 pm, Andrey [EMAIL PROTECTED] wrote:
I doubt It will be O(n^3)..
Dynamic programming algorithm, by size of submatrix, will give at
least O(N ^ 4), won't it?
--~--~-~--~~~---~--~~
You received
of arr[a][c], arr[a+1][c], ... arr[b-1][c] handy (
i.e. in O(1) algo). But that's fine, we can precalc them using prefix-sum
(O(n^2)).
Look at my post inwww.algorithmist.com... search for UVa problem 108 -
Maximum Sum.
Good luck.
On 10/12/07, Andrey [EMAIL PROTECTED] wrote:
Does anyone
No, I am not trying to do that at all. The trie is built to contain
only keywords. It can then be used to answer the question for the
current character 'Is this character part of a candidate keyword?' and
do this O(1). Candidate keywords are identified initially by the trei
root returning a
No, I am not trying to do that at all. The trie is built to contain
only keywords. It can then be used to answer the question for the
current character 'Is this character part of a candidate keyword?' and
do this O(1). Candidate keywords are identified initially by the trei
root returning a
I have to admit that I was wrong in my previous post. I stated that if
we have all words in the enumerated we can operate with them better
(faster) but it is true. Enumeraing of the words makes no sence..
Similar objections to using a hash table to assign integers to words.
If collisions are
(N + M) + N + M
So if we don't have all word already enumerated you are right.
On Oct 1, 4:10 am, Andrey [EMAIL PROTECTED] wrote:
Check this program:
#include map
#include string
#include iostream
#include algorithm
#include iterator
using namespace std;
class Range : public
Check this program:
#include map
#include string
#include iostream
#include algorithm
#include iterator
using namespace std;
class Range : public pairconst char*, const char* {
public:
size_t size() const { return second - first; }
Range(const char* f=0, const char * s=0)
21 matches
Mail list logo