This is similar to maximum sum contiguous subarray problem. Consider the
circular array as a normal array, except that once you reach the end of the
array, if the sum found upto that element(using Kandane's algo, refer Wiki)
is negative, then try including elements from the beginning of the
Hi Friends,
I know this is a little bit 'off-topic', but I think it would serve the
overall purpose to educate ourselves well. I will still apologize if this
seems like spam to you.
We'd like to present to you www.kbooksearch.com, a site that compares the
prices of a book across the different
@himanshu making constructor protected is okay because even for abstract
base class u cannot create objects in derived class
--
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
yeahu r ryt
On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed
firozkhursh...@gmail.comwrote:
Well, when i compiled the code the output ie i is alway i=2,
http://ideone.com/AFljo
http://ideone.com/87waz
This expression is ambiguous, and compiler dependent.
--
You received this
If the constructor is made protected u cannot make object of that class
anywhere
On Tue, Jul 10, 2012 at 3:10 PM, Bhaskar Kushwaha
bhaskar.kushwaha2...@gmail.com wrote:
@himanshu making constructor protected is okay because even for abstract
base class u cannot create objects in derived class
int no_of_steps[arr_length] = {MAX};
if ( (arr_length==0) || (arr[0] == 0) ) //if there are no elements or
the very first element is 0 - we can't jump anywhere
return MAX;
no_of_steps[0] = 0; //no jumps required to jump from element 0 to itself.
for (int i=1; iarr_length; i++)
{
This can be solved using Dynamic Programming approach.
Let MinJump(n) = Minimum number of Jumps required to reach the Nth index
of array A.
then, for 1 i N, MinJump(i) = Min{1 + MinJump(j)} for all j such that
(0= j i) and (j + A[j] = i).
We can prepare an auxiliary array say MinJump[1..N]
@g4... : Is the sequence in which children are arranged is fixed or the
teacher can change the sequence to minimize the candies ?
On Mon, Jul 9, 2012 at 3:58 PM, Anshu Mishra anshumishra6...@gmail.comwrote:
@sanjay it's not like that
e.g : (3 5 6 7 8 4) 7
1 2 3 4 5 1 2
Yes we have
For such case .. circular linked list will come handy to be able to delete
last node.
On Tue, Jul 10, 2012 at 8:28 AM, deepikaanand swinyanand...@gmail.comwrote:
No there is no way to delete the last node in such a situation
though u can replace the info part of such a last node with
^ cout no_of_steps[arr_length -1];
On Mon, Jul 9, 2012 at 8:44 PM, algo bard algo.b...@gmail.com wrote:
int no_of_steps[arr_length] = {MAX};
if ( (arr_length==0) || (arr[0] == 0) ) //if there are no elements
or the very first element is 0 - we can't jump anywhere
return MAX;
Minimum no. weighings:
Divide 8 coins in group of 3, 3 and 2.
For minimum weighsing group1 's total weight is x units(say) --FIrst
weighing
Groups 2nd total weights is y units Second weighing.
Lastly one more weighing among a unit and b unit coins.---3 rd weighing
So minimum 3
http://translate.google.com.br/translate?sl=pttl=enjs=nprev=_thl=pt-BRie=UTF-8layout=2eotf=1u=http%3A%2F%2Fmarathoncode.blogspot.com.br%2F2012%2F07%2Fquebra-cabecas-indutivos.html
But again.. this can be reconstructed at the sever. taking first number and
adding the differences.
On Monday, 9 July 2012 23:54:23 UTC-4, enchantress wrote:
Give the first first number and set of cosecutive diffrence.
On Sunday, 8 July 2012 10:55:55 UTC+5:30, Sairam wrote:
How do you
@navin...Sorry didnt get you how come u were able to segregate all the
coins by the proposed method??
On 7/10/12, Navin Kumar algorithm.i...@gmail.com wrote:
Minimum no. weighings:
Divide 8 coins in group of 3, 3 and 2.
For minimum weighsing group1 's total weight is x units(say) --FIrst
Let we have 8 coins named (for simplicity) x1, x2, x3, y1, y2, y3, a, b
According to your question 3 of them weigh x units : x1+x2+x3 =x
3 of them weigh y units: y1+y2+y3 =y
now consider the case when i grouped (x1, x2 x3) in single group
(y1,y2 ,y3) in one group and (a,b) in one group.
Now
for complete tree tree at last level can have left child and no right
child , thus condition shd be somewhat like this...
if(node[right]==NULLnode[left]==NULL)
return true;
if(node[right]!=NULL) // if the node Rchild!=NULL then there shd be Lchild
present.
if(node[left]==NULL)
@Gupta: You haven't defined the problem sufficiently.
What type of scale do we have, a balance scale or one that gives a numeric
reading?
Do we know x, y, a, and b, or are you just saying that one set of three
coins weigh the same, another set of three also weigh the same but have
@sumit the sequence is fixed
--
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
algogeeks+unsubscr...@googlegroups.com.
For more
Given two strings .Print all the interleavings of the two strings.
Interleaving means that the if B comes after A .It should also come after A
in the interleaved string.
ex-
AB and CD
ABCD
ACBD
ACDB
CABD
CADB
CDAB
--
You received this message because you are subscribed to the Google Groups
http://www.geeksforgeeks.org/archives/17743
On Tue, Jul 10, 2012 at 11:16 PM, Navin Kumar algorithm.i...@gmail.comwrote:
Given two strings .Print all the interleavings of the two strings.
Interleaving means that the if B comes after A .It should also come after
A in the interleaved string.
--
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/-/zLgbYxJdPYwJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
he is right.
On Tue, Jul 10, 2012 at 3:13 PM, rahul sharma rahul23111...@gmail.comwrote:
yeahu r ryt
On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed
firozkhursh...@gmail.com wrote:
Well, when i compiled the code the output ie i is alway i=2,
http://ideone.com/AFljo
can u explain ur algorithm for the sequence
*
5 4 3 2 1*
--
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
++i/i++= 6/6
++i * i++ = 36.00
http://ideone.com/j4n0Q
On Tue, Jul 10, 2012 at 3:13 PM, rahul sharma rahul23111...@gmail.comwrote:
yeahu r ryt
On Tue, Jul 10, 2012 at 10:01 AM, Firoz Khursheed
firozkhursh...@gmail.com wrote:
Well, when i compiled the code the output ie i is alway
for your example
5 4 3 2 1
5 4 3 2 1 -- candies assignement.
(since the length of the longest decreasing sequence is 4,
and length of increasing seq. before it is 0.
its max(0+1,4)+1 = 5
--Sravan Reddy
On Tue, Jul 10, 2012 at 8:09 AM, bala bharath bagop...@gmail.com wrote:
can u explain ur
Here you have to first sort both the arrays A and B and merge both the
arrays to form the sorted array C
--
Akshat Sapra
Under Graduation(B.Tech)
IIIT-Allahabad(Amethi Campus)
*--*
sapraaks...@gmail.com
akshatsapr...@gmail.com
rit20009008@
I think you missed the question:
Its a stable merge. (order of elements in each array should be same)
Sorting will destroy the original order.
Thanks,
Mr.B
[Please include complexities and pseudo-code]
On Tuesday, 10 July 2012 16:18:04 UTC-4, Akshat wrote:
Here you have to first sort both the
I found a similar solution looking somewhere else.
The solution for this problem is:
a. There can be atmost 3 elements (only 3 distinct elements with each
repeating n/3 times) -- check for this and done. -- O(n) time.
b. There can be atmost 2 elements if not above case.
1. Find the median of
@ Dave sir
the balance considered here is simple balance scale incapable of
giving any numeric reading and the we are unaware of any relationship
between x,y,a,b or any kind denominations prioirity in terms of
weights...
@navin..
3 of them weigh x means 3 of the coins individually weigh x gms,it
http://www.geeksforgeeks.org/archives/17743
Using the above problem we get all possible merges , at each possible
merge, we can calculate the sum.
On 7/11/12, Mr.B sravanreddy...@gmail.com wrote:
I think you missed the question:
Its a stable merge. (order of elements in each array should be
@payal:
In this case too i think minimum number of weighing required is 3.
Slightly change in my previous solution. x1+x2+x3 = 3x and y1+y2+y3 = 3y.
On Wed, Jul 11, 2012 at 8:00 AM, payal gupta gpt.pa...@gmail.com wrote:
@ Dave sir
the balance considered here is simple balance scale
pls discuss about prilims, online coding round too !!
regards,
Karthikeyan.M
On 7/11/12, arumuga abinesh arumugaabin...@gmail.com wrote:
http://www.geeksforgeeks.org/archives/17743
Using the above problem we get all possible merges , at each possible
merge, we can calculate the sum.
On
32 matches
Mail list logo