@saurabh :
so you scanned to find out that both lists are same : O(n) (agreed)
prepare list 3 in time O(n) (agreed)
process list 3 in time O(n) (*HOW ??*)
can you run through your method and show how you process list 3 in O(n)
using the below lists as input:
5->5->5->5->5->5->5->5->5->5 and
4->4->
initial assignmnet: g()={n1,..,nd)
inter(i)
{
if(i<0) return;
for(int j=0;j wrote:
> Can you please help me with this one.
>
> write two algorithms that iterate over every index from (0,0,..,0)
> to (n1,n2,..,nd).Make one algorithm recursive and the other
> iterative.
>
> Th
Hope you meant a pattern is sub-array containing 2 or more UNIQUE chars.
hope based on dfn, "abcd" is also a pattern in the input you have given.
On Tue, Feb 2, 2010 at 1:11 AM, ankit mahendru wrote:
> Q. Find all the patterns once which are present in the character array
> given. A pattern is a
nope,
if both lists are of same length list 4 is not required and you save time to
deal with list 4
so, you have list 3 only
time reqd is O(3n)
3 passes approximately
On Mon, Feb 1, 2010 at 11:24 AM, Algoose Chase wrote:
> Thats true ! , The purpose is to add very long integers such that we c
Q. Find all the patterns once which are present in the character array
given. A pattern is a sub-array containing 2 or more chars.
Example:
i/p: aabcdadabc
o/p: ab, abc, bc, da
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to thi
the key observation is that your requirement for no space is nullified by
using the space in the resultant list.
so you scanned to find out that both lists are same : O(n)
prepare list 3 in time O(n)
process list 3 in time O(n)
current list 3 is the answer as list 4 is empty
total time O(n) as k
Can you please help me with this one.
write two algorithms that iterate over every index from (0,0,..,0)
to (n1,n2,..,nd).Make one algorithm recursive and the other
iterative.
Thanks
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
T
Thats true ! , The purpose is to add very long integers such that we cant
use premative data types to represent them.
The point I was trying to prove is : you would need to go through multiple
passes through the list(essentially to propagate carry) when you have
conditions like No Reversing the
This is clearly explained in the previous mail isn't it ? .. Anyway,
sum of 1..n is S = n*(n+1)/2 . So, find the sum of all elements in the given
input array, say the sum is T, this sum is almost same as S, its just less
than S by the missing number. so, ( S - T ) will give the answer. Are you
look
A way to solve this problem would be using xor(exclusive OR)
xor all the elements from 1 to n.Call it A
xor all the elements of the array into a variable B
Now missing element = A xor B
It works this way
xor-ing an element with itself gives 0(p xor p=0)
xor-ing an element with 0 gives the element i
10 matches
Mail list logo