Typically what we need to do is a BFS.
But there are more advanced algorithms like Link prediction etc..
A recent paper on same topic might be an interesting read.
events.linkeddata.org/ldow2011/papers/ldow2011-paper08-dhekane.pdf
On Mar 22, 6:05 pm, snehal jain wrote:
> If you want to search f
Using GOTO and loops it the same, cause loops are expanded to GOTO/JMP
statements.
Doing it just with recursion is interesting.
Try sorting number without using loops or goto.
Here is the complete problem.
Take in n numbers as input and sort them, without using dowhile,
while, for or goto. No hash
I would negate all numbers and reheap. re negate all numbers once its
completed.
On Oct 20, 1:49 pm, "juver++" wrote:
> You may use usual linear algorithm for constructing heap.
> Simply adjust the heap property for all internal nodes.
>
> On 20 ÏËÔ, 11:47, MAC wrote:
>
>
>
>
>
>
>
> > Convert a
Since its a data structure, we need to root the tree. Plus my
suggestion will only work for directed trees. all children point to
their parents.
for a node i, if its parent is j a[i]=j
a[root] = -1
this can store a tree pretty fast.
else normally we can use a linked list etc.
On Nov 14, 11:53
On Nov 14, 10:58 pm, bittu wrote:
> ya much works is done by above candidate.
> i would like to say..use 2 ptrs one from beginning & another from end
> take sum=a[start]+a[end];
> find if sum>num
> end--
> else if sum start++;
> else //sum==num
> found;
>
> time compexcity O(n) sizeof array
>
On Oct 27, 8:21 am, "MOHIT " wrote:
> @ruturaj : but for that hash table you have to know range??
Nope we dont need the range.
#include
map hash;
for(int i=0;i 0)count++;hash[a[i]]++;
does the trick.
--
You received this message because you are subscribed to the
Yes, its a quite an interesting problem and solved using parallel
programming many times.
I think the idea , as Ercan thought of, is to do a binary search.
Consider 2 arrays A and B.
Divide both arrays into logn sizes blocks.
For each block let the first element be the head element. Now cross
find
To solve this we use a hash table (stl perhaps)
for i=1 to n:
if (hash[m-a[i]] == 1)pair found;
else set has[m-a[i]] = 1;
with this everytime we hit m-x and we have hit x till now we get a
pair.
On Oct 22, 4:32 pm, RIDER wrote:
> you have an array of n integers, how would you find the integer pa
I didnt understand the above solution, but I have a bad complexity
solution.
Make an nXn boolean adjacency matrix.
Run transitivy closure on the matrix.
For every node w, check if for all v E V, w->v=> v->w
On Oct 13, 9:52 pm, praba karan wrote:
> spoj.pl/problems/BOTTOM
>
> my algo for this prob
I am thinking on these lines.
Start from any node. DFS to the fartheset node from there. let the
farthest node be B. Start a new DFS from B to reach the fartheset node
from B , let that be C. It can be proved that BC is the longest path
in the tree. Then, the node in the center will be the answer
a 5 digit number is of order 10^5 which is << 10^16 of which int in C
is of size.
Just multiply both numbers.
On Sep 2, 10:39 am, prasad rao wrote:
> Program that takes a 5 digit number and calculates 2 power that number and
> prints it and should not use the Big-integer and Exponential Function'
11 matches
Mail list logo