#include
#include
#include
#include
using namespace std;
// It is not advisable to list all elements in this hash table.
#define HASH_SIZE 51439
class HashTable
{
public:
vector< map > table;
HashTable()
{
table = vector< map >(HASH_SIZE);
}
int hashF(long long key)
{
if( ke
you can write a python program to do that easily.
program starts here :
c=str.split(raw_input())
d=[]
for x in c:
d[x]=0
print list(d)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@
correctness is by induction on number of
cycles.
thx
aj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from
well the set (X + Y) will have O(n^2) elements, where X and Y have n
elements.
As an example
X = {1, 2}
Y = {3, 5}
X + Y = {1 + 3, 1 + 5, 2 + 3, 2 + 5} = {4, 5, 6, 7}
Now the problem is to find the median of X + Y in subquadratic time.
thx
aj
How about finding the median of (X + Y) in subquadratic time.
X + Y = {z | z = xi + yj for some i and j}.
I could only reduce the space complexity from O(n^2) to O(n) but time
complexity still
remains O(n^2).
thx
Aj
--~--~-~--~~~---~--~~
You received this
that's right, it has worst case quadratic time complexity.
W Karas wrote:
> aj wrote:
> > linear worst case time.
>
> The best I can do is:
>
> bool is_palin(const char x[], unsigned len)
> {
> if (len < 2)
> return(true);
> for (u
linear worst case time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL P
hi daizi,
I was expecting a solution that does not use suffix trees.
Using suffix trees
the problem can be solved easily, but I was just wondering if it is
mandatory to use
complex data structures like suffix trees to solve this problem.
thx
aj
Given a binary string x of length n, find the longest prefix of x in
linear time which is a palindrome.
thx
aj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this g
gth of
the subsequence) then your solution is excellent with O(n) time and
O(1) space complexity.
thx
Aj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, sen
hey syed,
where are you right now? me at EPFL, switzerland. By the
way your solution is same as mine (dynamic programming one).
Aj
B.Tech (CSE), IIT Kanpur '03
--~--~-~--~~~---~--~~
You received this message because you are subscribed t
with at least L elements.
I hope I didnt misunderstood what you wanted to say
Aj
ps: in your code there is no guarntee that the the subsequence has at
least L elements.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
pe it helps
Aj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROT
the matrix
1 1 1
1 1 1
1 1 1
has rank 1, but is still rearrangable, so it seems linear dependence
has not much to do with the problem.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To po
SPX2 wrote:
> what complexity aj ?
O(ne) where e is the n is the number of rows and e is the number of 1's
in the matrix.
worst case O(n^3).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm
olumn
entries 1 (r < k), and in that case even permuting columns will not
help as these k rows can cover at most r diagonals, i.e., A is not
rearrangable.
hope it helps
Aj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
scheduling, or this
small modification moves the problem from the class P to the class of
NP-complete.
thanks in advance
Aj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post
17 matches
Mail list logo