sort the first array -> O(d*n)
sort the second array -> O(e*n)
compare the two arrays -> O(n)
the solution : (d+e+1)*O(n) = O(n)
Use it only if (d+e+1) is smaller than the hash constant.
Bruno Avila
2006/7/19, ridvansg <[EMAIL PROTECTED]>:
L7,
from the first array make a hash table H-> O(n)
go through the second array and test if the element is present in H1
->O(n)
so the solution is 2*O(n)=O(n)
Your solution:
sort the first array -> O(n log n)
sort the second array -> O( n log n)
compare the two arrays -> O(n)
the solution : 2*O(n log n) + O(n) = O( n log n)
Siva how will you use the B-tree, so you can make one node to
correspond to one block in the disk but how will you contro the writing
the each node to the disk. This is a issue of low level programing for
me. Siva please explain?
--~--~---------~--~----~------------~-------~--~----~
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 PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---
- [algogeeks] Which is the fastest solution for... Ovidiu.Silaghi
- [algogeeks] Re: Which is the fastest sol... Siva
- [algogeeks] Re: Which is the fastest... L7
- [algogeeks] Re: Which is the fas... ridvansg
- [algogeeks] Re: Which is the... L7
- [algogeeks] Re: Which i... Piramanayagam Arumuga Nainar
- [algogeeks] Re: Which i... ridvansg
- [algogeeks] Re: Which is the... Bruno Avila
- [algogeeks] Re: Which is the... Siva
- [algogeeks] Re: Which is the fastest sol... luciferleo
- [algogeeks] Re: Which is the fastest sol... Gene
- [algogeeks] Re: Which is the fastest... Ovidiu.Silaghi
- [algogeeks] Re: Which is the fastest sol... makc.the.great