@ashish goel:can you plz give the link
On Mon, Feb 14, 2011 at 9:00 AM, Ashish Goel ashg...@gmail.com wrote:
check on code.google.com
a very nice code there, that i had picked 1 yr back...you may like to
find
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
On Unix computers, data is stored in directories. There is one root
directory, and this might have several directories
contained inside of it, each with di fferent names. These directories might
have even more directories contained inside of them,
and so on.
A directory is uniquely identified by
***DELHI TECHNOLOGICAL UNIVERSITY*
*(Formerly DELHI COLLEGE OF ENGINEERING)**
CSI-DTUPHOENIX'11
presents
FIREWALL*
*The Art Of Hacking
*
*
*
Do you swear by having the key to every single lock?
Do you think you possess the innate talent of finding loopholes in anything
and
DELHI TECHNOLOGICAL UNIVERSITY
(Formerly DELHI COLLEGE OF ENGINEERING)
PHOENIX'11
presents
@^^ many solution to this problem in O(n)
METHOD 1(Use sum formula)
Algorithm:
1. Get the sum of numbers
total = n*(n+1)/2
2 Subtract all the numbers from sum and
you will get the missing number.
Time Complexity: O(n)
METHOD 2(Use XOR)
1) XOR all the array elements, let the
We have three arrays
A=[a1,a2,...an]
B=[b1,b2,...bn]
C=[c1,c2,...cn]
Write a method which takes these three arrays as input and return true
if there is a combination [ai,bj,ck] such that ai+bj+ck = 0.
O(n^3) solution is obvious. The questions is can we do better than
this?
Thanks
i have a n^2logn solution
sort the third array,.. then for every pair in a and b search for the number
which makes the sum zero using binary search
but guess a better soln must exist
On Thu, Feb 17, 2011 at 11:38 PM, bittu shashank7andr...@gmail.com wrote:
We have three arrays
Here are two methods to do in O(n^2)
1) Insert elements of first array in hash and then for every pair of
elements in (Bj, Ck) find if -(Bj + Ck) is in hash
2) Without extra space:
sort arrays A and B
now for each element in Ck find a pair (Ai, Bj) which sums to -Ck as below
let p1 point to
In O(n^2). Sort two of the arrays, say B and C, into ascending order.
For each element in A, search forward in B and backwards in C looking
for a zero sum. Something like this, using zero-based arrays of length
n:
int i, j, k;
for( i = 0 ; i n ; ++i )
{
j = 0;
k = n-1;
while( (j n)
you have 2-d array, with m length and n width.You are also given k,
( k=n k=m ).
Now, select a square of size k, which returns maximum sum.In Minimum
Time Complexity
Thanks Regards
Shashank.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
I fail to see how any of them work in the general case.
In fact, I don't even see them working with range restrictions for n. Also
what is the missing number you are talking about? The question is to find
the repeated number. As I said before, its an element uniqueness problem
whose lower bound
11 matches
Mail list logo