Requires review and comments:
My solution:
find the continuous increasing sequences from the input followed by
continues decreasing array.
let there are k such array (continuous increase followed by continuous
decrease)
Now we have the trivial components. find sum for each such array.. and sum
i was thinking of character array. which is same as string.
Any thoughts on better alternatives?
On Friday, 6 July 2012 13:34:01 UTC-4, anshu wrote:
yes, We can have much better data structure for storing big integer
instead of string just for simplicity I have taken string.
On Fri, Jul 6,
@Don:
I had the similar approach, but I didn't think of dividing by (n-1)!
Why is this needed? -- I think this is to avoid the cases in which, just
the order of picking the nodes is different and lines drawn are same.
How is this (n-1)! -- i might be missing the the very basic thing.. plz
@Don:
thank you.
each possible arrangement of lines can be done in (n-1)! ways.. and only
one is needed of it.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@Dave:
you mentioned that there is a way to fix the issue caused by calleing
swap(t,u,int) -- how can we fix this in preprocessor directive?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
maintain an Adjacency matrix.
Matrix state: for each element(row), mark as 1 for a column, if row-
column is reachable.
when inserting, at (a,b) check
if (b,a) is '1', if yes.. then there is cycle. (don't insert, or report)
else add == mark (a,b) =1 and do the below step
for each col,
@Don:
The solution looks good...
I can see that the greedy choice property is holding.. and its optimal
too...
max (j+a[J]) maximizing is leading us to the farthest possible position,
but.. in the beginning.. i thought.. this will have probs with 0's
but.. couldn't come up an example, for
since there are N leaves...
N/2 leaves(i will call nodes) will share only root. why? (they are on the
other side of the root)
N/4 leaves share 2 nodes
N/8 leaves share 3 nodes...
so on...
= there are N paths, as there are N leaves, (or N-1 to be precise..
excluding leaf v )==
so.. its N/2 * 1
what does it mean.. we cannot use an array? (a static array?)
a vector is an array..but a dynamic one... what other DS can be used? a
linked list allowed?
(each of the two algorithms can be mate to work with linked list too...
(except that it takes more time.. )
--
You received this message
@phoenix:
NULL character is \0 -- ascii value 0x00
Number 0 is char '0' -- ascii value is 0x30 or 48
so, 48 when encountered.. it prints.. 0, when \0 is found... it stops...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
@atul:
I got this now... very good one... the space is O(1) right, as what ever
the the values we store in matrix, can be reverted back in similar way..
i haven't thought of the kadane's algo that comes within the inner loop,
the O(n^4) solution i thought will search brutefocely in the inner
@Shashank: can you look at the first post from you?
you are calculating 3^a[i] adding it to the sum,
can you write a pseudocode so that none of gets confused.
(also, if you are saying this.
for each element, raise element to the power of 2 (2^a[i]), (like you said
in above post), or 3, like
I agree with Gene,
10^80 is of very larger magnitude, and is no way possible to solve given
any amount of time,
He might be testing you to '*think it practically before jumping to answer
the question*' (or) he/you must have gone wrong somewhere.
(even to read that input it takes for ever..)
Hi atul:
Can u give the complexity for ur algorithm.
I think of an O(m^2n^2) =~ O(n^4) algorithm, with constant space.
The kadane's algo should be applied on a 2-d data right.. that takes the
complexity to order of 2.
--
You received this message because you are subscribed to the Google
@atul:
on the first look, even I thought the same.. O(log N).. and this is may be
true for the given precision.
*[-- the following may not be related to given qn.] -- but.. can u comment
on this view point..*
but.. I am thinking that, the complexity is dependent on the level of
precision
@himanshu:
from the line after fork().
(as I assume, even the program counter is copied with the same value.)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@Lucifer: a very good counter example involving the -ve numbers..[:)]
I never thought of negative numbers while looking for solution.
And I don't see a O(N) solution for this --
1) Find the first pair (i,j) such that:
sum( A[0] .. till A[i]) = sum(B[0] ... B[i]) -- ESP when there are
@Lucifer, I was thinking in the similar lines, but, I couldn't get the
exact way of re-arranging the sub-matrix,
Please throw some inputs or links which can solve that Rearrange in
O(M+N) time.
Problem I see:
when we identify the position for a[i+1][0], and we repace it with a[k][l],
the
@Lucifer: great explanation.
and very good idea that the matrix is like a 'heap'
I didn't see your post.. not I get it.. :)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@Shashank:
from your code, i looked at this part.
for j=0 to m
sum2+=3^b[j]
i assumed 3^b[j] as power(3,b[j]);
== (2,0,0,0) - 9+1+1+1 (1,1,1,1) = 3+3+3+3 both equals 12.
and.. i didn't understand what you meant by base here. did you mean
anything else?
or did I miss anything?
(how can we
solution at this link:
http://ideone.com/ifVIv
for every position, (iteration)
maitain left, right for the sums,
keep adding elements towards the begenning to left, and towards the end to
right, (based on the conditions in the code)
Complexity: outer forloop : O(n)
inner while loop O(n)
The question mentions of Subarray (which is like a substring in the string)
I think you are assuming it to be any subset, in that case even O(n^3) time
will not be sufficient and its an exponential time algorithm.
with the subarray like my assumption, the bruteforce approach will be to
find
and.. yes for this example,
-2, 8, -6 it results in No solution. (or doesn't print anything.)
but works if its -2, 8, 6 where (-2+8 == 6)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
this is similar to the Pixel fill algorithm usually used in photo editing
softwares (photoshop or paint )
BFS would be best approach to start with ( and check 4-adjacent or
8-includeing diagonal elements for a '1' and include that to queue. When
the queue becomes empty, increase the count by
@atul: given a matrix just like above, (usually an image) the pixel values
with similar can be searched for around the current pixel, and they all can
be marked in one go,
think of an algorithm, which does the following
1) when a one is replaced by '2' manually, then algorithm changes every
@atul:
+1, i too thought the same
this comes handly esp, when the derived datatypes are used with a range
limitations.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@Deepak: Digitization of the image doesn't have a algorithmic approach,
(unless you need to compress it)
But, i see that you are asking for a way to convert the image (jpg) into a
memory representation.
I am not sure of matlab, but, using java (images API) you have to read the
data into
@Gene: I didn't understand on what you termed as embedding Can you
provide more insights on this?
@dabbcomputers: also, listing set of points (not just one) isn't going to
be a better than O(n) solution.
for eg: a value of R that eliminates only half the points outside the
circle.
--
You
@shashank:
sorting the hashed values is more intensive than using the heap with size
K. (as kN)
sorting hash -- N log N
using heap -- N log k
also, i just read about the splay trees.. this can improve the performance
of 'N log N factor' right when used on input, though it can be used on a
@shashank: your approach fails for (2,0,0,0) (1,1,1,1)
but.. from any of the above approaches seen, we couldn't be 100% sure of
the solution,
but, from shashank's approach, the probability of finding correct soultion
can be improved by using some random prime numbers.
(running tests for more
Since A uses the MFU (most frequently used) to remove from memory, the
number used twice will not be in memory and never called for.
Mostly likely that A will win. (cannot say this 100% sure, though i don't
see a situation where S wins)
initial guess will be when any 5 numbers are repeated
any comments of the following approach.
first sort the weights,
find the 'j' such that sum( wts from w1 until wj) Wmax sum( wts from W1
until Wj+1) Wmax
also 'k' such that sum(wts from Wk to Wn) Wmax sum(wts from Wk-1 to Wn)
Wmax
so, a = j ( is the max number of elements in any subset,)
@atul007: When you mean n^2 solution.. did you mean the DP which actually
is 2^n??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/MrOfjqZKk8YJ.
To post to
@atul007: the 0-1 knapsack is a special case of subset sum problem, (and..
i don't think its easy to find all the solutions using 0/1 knapsack.. )
@shady: is it possible?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
@dabbcomputers: looking at the worstcase, listing all points in the set
itself takes O(n) time,
just to speed up the time would be sort all the points(x,y) wrt x-values
another with sorting on y-values,
and restrict the target solution space to (x +(or)- R) (y +(or)- R) and
work on those
@arun: http://mindprod.com/jgloss/immutable.html
this might help you, in essense, if a compiler treats them as immutable,
the reason is to reduce the overhead of creating another contant literal
(as explain at the link, the string literals are the most commonly used)
this is from a java (or
This is still N^2 solution.. If i'm not mistaken?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/zbJxeO-T4sMJ.
To post to this group, send email to
@Gene:
I am wondering about the the N log N factor.
I agree with the log N component, but, can u clarify on the first component
in N * log N (N being no. of unique numbers)
we still check for each element in the input (n), the binary search among
'N' unique values.
Isn't this n log N
n -
any better approach than O(N log N) time?
maintain a heap of nodes value, count
for each element, if already present increase the count. Else add the
elements.
Max-Heap -- fetch the node, print it count number of times, (time to
search in heap -- log N)
doing this for N elements.
--
You
Sort the numbers based on the 'index_position' (starting at most significat
digit) -- a modified version of MSD radix to be used.
or sort the numbers as sorting the strings, (print all in desc order).
--
You received this message because you are subscribed to the Google Groups
Algorithm
An idea is to start with a heap of size k.
Its tricky how to keep track of the start and end indices of the smallest
length. Do not enter a duplicate element in the heap.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
Its NlogN if balanced.. Else N^2
For each element it's visiting at most log N elements.(assuming balanced)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Start with counting sort of the input.
Use shuffling algorithm on it.
Store index as cumulative sums of counts.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Is it (k)th smallest element (distict integers)
or the element at position k, when both are merged?
455566777
-- Is 3rd smallest element '1' or '4'
If four, I am not able to think of a log complexity. Can u post your
recursive
any better solution than O(N^2) in worst case?
How do we take advantage of sorting and find in O(N lg N)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
#includestdio.h
int main(){
//int pet[5]={10,1,19,19,1};
int pet[5]={10,1,18,20,1};
int point[5] = {10,20,30,40,50};
int tmp[5],index=0;
int i;
tmp[0]=pet[0];
for(i=1;i5;i++){
tmp[i]= pet[i]+tmp[i-1];
Sorry..
this is good one,
but works for consecutive numbers only from 1..N
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/07wiKGP2WusJ.
To post to this
The next question interviewer would ask is.
the length of the string is not small. and if they mentioned it as m, we
can't assume it to be constant,
anyway.. the formula O(nm log m) -- will be converted to O(nm) or O(n)
based on what you assume m to be.
Another Question: log (m) goes
This might sound silly. But I have a doubt here.when you mean convert inorder
or preorder to a bst. Are the inorder traversel elements given and we need to
construct a bst?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
@Don, Gene:
very good insights,
didn't even thought of the changing the executable, but it indeed is one way
to do.
:)
@Don: agree with scripts and interpreted code.. :)
[coming out of the same language helps answers some questions easily]
--
You received this message because you are
@Sunny, Rahul:
Thanks a lot.. :)
@Anshu: the code is perfect, This would be h = n* (height of BST) -- O(h)
O(n^2) is the worst case right? and has complexity similar to quick sort?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view
It should be O(n.m.log m)
the hash fn choosed here was sorted_char_string -- abc, bac, cba, ... all
result in abc.
how about, (a*b*c)+ (a+b+c) -- it can store the space considerably, if we
use a integer, (just m) instead of log m.
but we need to prove that for any two sets of integers
Wee are already members.. What is expected from us..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/vMtV3ewVYSgJ.
To post to this group, send email to
Yes.. And the reason is best case of insertion sort is in the order of n.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/_OJfijjiFVoJ.
To post to this
@don
Do you mean read the source and modify the hard coded value..
This will involve the the compile and linking steps right?
Did you mean some thing else?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web
I that is what is suggested in the above code. Even here you can avoid the
sorting and add all with same x coordinate.. O(n) space as suggested..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
This appears to be n^(3/2) complexity, looking at one of the solutions in
http://stackoverflow.com/questions/575117/pythagorean-triplets
assuming elements as sorted. (x cannot be greater than sqrt(2z) as x2+y2 =
z2 -- for the worst value of y2 -- 2x^2 = z2
MaxX = ( 2 * N - 1 ) ** 0.5
for x
This is doing a leftshift equivalent right?
its asked if there is another solution..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/vc7DL3vWVy8J.
To post to
Even I see this as the best solution...
O(n) time and space..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/sIzIL2amUckJ.
To post to this group, send email
OK..
what is expected?
its again sort problem, unless the amount of distortion is constant, in
which a Binary search or Insertion sort can be employed to do in O(n) time.
Didn't give a programmatic thought. But, if the the amount of distortion is
of order n, then sort in O(n lg n)
--
You
the only way to do this is to store in an external space like file.
if its a function that is called, a static variable can be used to track
count.
Question: Can extern variables span accross processes? They cannot right. I
mean two forked process share the same extern variable instance??
--
Hi Anika,
Can you comment on the complexity of the algorithm?
It appears to be like an O(n^2).
By the way, we are asked for a inplace sort, and this recursive call stores
the 3 element(a,b,c) in each level.
So, i iterations, and starting value of i is n/3.. so this takes an
additional O(n)
weblink for IN?OUT shuffle card shuffling prob related to
this scenario.
and Memory efficient rearragnement of array elements.
Thanks,
sravanreddy001
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https
This is calalan Number. where n = k+1
very interesting and complex probs...
http://en.wikipedia.org/wiki/Catalan_number
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
cheers..
clear explanation. thanks for the effort.. :)
so.. we swap 3 elements and.. run for one complete cycle of N/3 time in
this prob..
Anika has a recusion of N/3 depth.. may be.. a loop that runs N/3 time
should suffice.
:)
--
You received this message because you are subscribed to
Without sorting the elements we have around n^2 elements to look from, to
find the smalled element.
But, after sort, we will have only n-1 elements to look from. So, O(nlogn)
is what I see, the best case.
Is there really a O(n) solution, as finding the diff between elements should
be done
Just went throught what a count sort is at
http://en.wikipedia.org/wiki/Counting_sort
If all the elements are distinct which is possible, will this count sort
have any use?
Also, the sorting takes O(nlogn) time right?
Did I miss anything?
--
You received this message because you are
The swap is happenning between the p q pointers,
https://ideone.com/4MdX4
p points to y, q points to x after swap.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
I'm not sure if I got the question correct.
How about change the address of stack to point to top and then
modify the push,pop functions to retrieve values as
push(int a){
stack[--top] = a;
}
int pop(){
return (stack[a++]);
}
I know there is serious limitation of not able to add
in place means:
use constant extra space
in simple terms O(1) space
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/nDVS4k7fF34J.
To post to this group,
yeah...
i think its not possible without manipulating the pointers and then use
general retrieval logic.
reversal retrieval cannot be done without extra space, and without modifying
the DS. (like I
mentioned before, changing the stack to point to top manipulating the
push, pop functions.)
@ANKIT: your solution just compliments the bits at given locations... but we
are looking at swapping 2 different bit locations..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
how can your code ensure.. the top sqrt(N) elements being printed?
for 2nd questions. Its not possible be to do this in less than Linear time..
unless the array has some special property.. (already sorted)
--
You received this message because you are subscribed to the Google Groups
Algorithm
@akshata.. The algorithm for which u have expected a runtime of O(n^2)
i think it still runs only for 26 * n.. and. for a large values of n.. its
O(n)
here's the logic.. but also look how it works.
for(i=0;in;i++)
{
for(j=i+1;jn;j++){
{
}
}
this runs for n^2
for each character ch
Classes:
Board -- Final class
attributes being -- array of 100 positions:
Snake -- array of snakes to be used
attributes: start_pos, end_pos
Ladder -- array of ladders to be used
attributs: start_pos, end_pos
since both Snake Ladder have similar attributes.. we can have a common
before posting a qn. try to understand what's posted above.. and why like
that..
-- there could be multple designs.. but the best one comes after a good
discussions/ or exp.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
how about traversing the list once.. but.. looking at the user level.
now.. we make a hashtable kind of entry.. adding 1 to the count for each of
the combinations that comes in.
if the logs are tricky.. like.. joe's 3rd page comes after sam's 1st page in
the log.
then.. the logs first have to
@sanjay:
yes.. the optimization is nice.. may be even better if we have the array
split into 2 array's half each...
and yes.. the qn is already answered.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web
@rShetty.. ture.. the pivot element iteration doesn't maintain stability..
O(n) with O(n) seems to be better approach. -- pushing all elements into a
two linked lists.. and joining them in the end.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
@saurabh.. No man.. it involves variable number of calls.. even if its
present only once in code.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@vishal,Sanjeev..
for the inputs 18,187.. apply ur method..
18 -- 188
187-- 187
18187 - ur method
18718 - actual
@Sunny...
i agree that your algorithm takes the *O(N logN)* time.. but again..
the problem is it* doesn't get* the exact solution.
Do we really have a polynomial solution for this
and, I read it long time back that.. the value of 0.8 alone will be stored
as 0.7995 (not sure on the number of 9's but.. the last digit in the
precision will be a 5)
that could be a reason.
may be what vishal said is correct.
--
You received this message because you are subscribed to
Hi all. Can some one provide a good C editor.. preferable GUI one, that
works on windows 7.
I'm good with Java, but. now would like to get some hands on C, C++
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
Maintain a pointer A_end = m-1;
doing a comparision something similar to merge sort
int i=0;j=0;
while (i m){
if (a[i] b[j])
i++;
else{
swap(a[A_end],b[j])
A_end --;
j++;
}
}
This runs in O(m) time and no extra space, also the sort order is not
guarenteed.
--
You received this
@Dave,Balaji,Samby.. Without the matrix exponentiation, the time is not
possible, and without using the intermediate modulo operater as suggested by
Dave, the value cannot be accommodated, as the 300th fibinocci number alone
comes to
--
Two Step Process:
1) Finding the distance to every point for the requestion point
2) Finding the min among those.
(n+n) -- O(n).
I think it cannot be this simple.. more inputs please...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
I think that calculating the three Dimentional distance should be fine
right?
The distance between two points on the sphere will be proportional to the
chord connecting them.
Which is nothing but the three dimentional distance. and then going with the
2nd step of finding the min, value among
@Anyone worked on this before?
I'm thinking of a time complexity of *(log N)^2 -- Square of (log N)*
I've to prove on this..
If someone have time.. can you *prove that, the T'th fibinocci number is
always greater than 'N'*
*where T = (log N)^2 *
--
You received this message because you
@anshu.. I wanted to say to that.. even though I couldn't think of the
trignometic stuff..
thanks.. :)
--Sravan.
--
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
@akshata,
The (1,1) would be a special case.
for give N=1, but again for N=1, (2,1) also satisfies well.
And the series from then is constructed on the (1,0), (2,1), (3,2) So and
so..
Also if you see in the original problem statement, they mentioned a=b, but
not ab..
this is for the special
There is also another special case.. where N=0, in this case.. its (0,0)
-- 0+0 = 0
--
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
@bittu..
Given 2 nos. we need to divide them without performing divison.
*Please give a better solution than subtracting the nos. again and
again.*
The author has specifically mentioned this.
The order of this algo will be log(n) since the numbers are represented in
binary form.
against
finding a+rev(a) +.* is as good as finding -- a+rev(a)
The pattern searching is usuaally done in O(n) time if I'm not mistaken.
find the info below..
DID YOU ASK something else?
Single pattern algorithms
Let *m* be the length of the pattern and let *n* be the length of the
searchable text.
How about the following way.. where you can save some space.
but before that.. you meant, your application will need O(n) space for the
recursion only right?
in that case, instead of the recursion, try this approach.
set start, length = 0,
tempStart, tempLenght =0
set tempStart = i_value
@subharansu
When I meant the n/2 space in worst case, assuming u have 1 million total
numbers(n), and according to the problem,
it can have single non-repitive number. soo.. 99 entires will comprise
of at max 99/2 values.. assumuing.. none of them repeated more than
twice
Hi,
Can anyone share the places or locations for the algorithmic challenges,
puzzles etc.
here are few I know.
thealgorithmist.com (google it) -- Its not active now... but has previous
good set of articles..
topcoder -- really good
this site.. :P
please post all relevent sites... :)
--
You
can u explain ur solution with one of these sets?
{1,2,1,3,2,1}
{1,2,1,3,2,2}
an element can repeat for any number of times = 2
--
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.
Assuming there is only one element which i not repeated,
my approach will need O(n) space...
load all distinct elements and they counts as you traverse them first.. cost
= O(n)
searching an element from this.. O(n)
any better memory management here(i mean space)
--
You received this message
@shadow.. your approach fails if the same number has odd number of
occurances...
--
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
@ligerdave..
actually.. the problem is, O(n) is correct, but, this will again space
dependent where it is again O(n).. so.. it has to be done in constant
space.. no additional space.. so.. just swapping is allowed.. what's the
best time complexity for this?
--
You received this message
1 - 100 of 107 matches
Mail list logo