no all these data structure also take time O(nlogn)
solving this problem using segment tree
map all elements to its index on the sorted array.
ex. 2 3 8 6 1 -- 1 2 4 3 0
intialiize all element in segment tree wid zero
start from the last index of array
whenever u visit a node increase its
good answer
On Wed, May 11, 2011 at 8:52 PM, anil chopra anil.chopra2...@gmail.comwrote:
i will stop imaging.
On Wed, May 11, 2011 at 7:38 PM, Dave dave_and_da...@juno.com wrote:
I was on a river boat in Europe, and the emergency drill was to go to
the upper deck and wait, high and dry,
=
Journal of Emerging Trends in Computing and Information Sciences
Call for Research Papers (Vol. 2 No. 6) June 2011
http://cisjournal.org/
=
Dear Sir/ Madam,
Journal of Emerging
=
Journal of Emerging Trends in Computing and Information Sciences
Call for Research Papers (Vol. 2 No. 6) June 2011
http://cisjournal.org/
=
Dear Sir/ Madam,
Journal of Emerging
@Dave... I think 1 Googol Year is =10^100 not 10^116.5 ?? why u have
used
so then we have to write the single line program that googol years of
time ?? we have processor that can execute the instruction in 10^9
per second so the time required by googol year in second
which is equals to time
double n will overflow...
On 5/13/11, bittu shashank7andr...@gmail.com wrote:
@Dave... I think 1 Googol Year is =10^100 not 10^116.5 ?? why u have
used
so then we have to write the single line program that googol years of
time ?? we have processor that can execute the instruction in 10^9
Nice one anil
On May 13, 11:47 am, arjoo kumar 2009ar...@gmail.com wrote:
good answer
On Wed, May 11, 2011 at 8:52 PM, anil chopra anil.chopra2...@gmail.comwrote:
i will stop imaging.
On Wed, May 11, 2011 at 7:38 PM, Dave dave_and_da...@juno.com wrote:
I was on a river boat
When I replaced cout with printf in my code, I got AC!! I Should have tried
it earlier itself..
On Fri, May 13, 2011 at 11:51 AM, anshu mishra anshumishra6...@gmail.comwrote:
no all these data structure also take time O(nlogn)
solving this problem using segment tree
map all elements to its
*Yoga Teacher Training
More than 3000 teachers certified 200 Hrs, Yoga Alliance, June 2011
http://bit.ly/degreeZ
http://bit.ly/degreeZ
http://bit.ly/degreeZ
=*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
Q. Numbers are randomly generated and stored into an (expanding) array. How
would you keep track of the median?
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
--
You received this message because you are subscribed to the Google Groups
Algorithm
Hi
I m not able to post today as blogger.com is down today.
Please visit
*http://dailybrainteaser.blogspot.comhttp://dailybrainteaser.blogspot.com?lavesh=lavesh
*
for old solved puzzles.
I m sure you will enjoy them
--
Never explain yourself. Your friends don’t need it
This problem can be solved using 2 heaps and the median can always be
accessed in O(1) time ,the first node.
--
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
No Amir,it wont.We will not be able to store each and every digit in the
double though
Check out ieee floating point standard,that will clarify it.
But yes in the context of above problem the code wont work i think due to
precision problem...
On Fri, May 13, 2011 at 5:12 PM, Aamir Khan
And yes corrct me if i am wrong in the assertion that the code wont work
On Fri, May 13, 2011 at 7:24 PM, saurabh singh saurab...@gmail.com wrote:
No Amir,it wont.We will not be able to store each and every digit in the
double though
Check out ieee floating point standard,that will clarify
@Bittu: I wrote that a google years ~= 10^116.5 nanoseconds. If you
take the base-10 logarithm of your time t, you will get about 116.5.
Regarding your code, the dynamic range of doubles exceeds 10^116.5, so
you can calculate n. However, since n is approximately 2^387, but only
the high-order 52
@Aamir: No, it won't overflow. The maximum double is approximately
10^307.95. His value is well within the range of doubles. The problem
is that doubles don't have enough precision. See my preceding post for
an explanation.
Dave
On May 13, 6:42 am, Aamir Khan ak4u2...@gmail.com wrote:
double n
Hi, do you think that this is a nice problems?
For some set M, let there be partial orderings of M, 1, 2 of M.
We are looking for a merge of the pos 1 2 in he following sense:
- extends 1
- if there are x 2 y such that NOT x y (that is, the merge has
rejected that the relation x 2 y), then
*FUN MATH PUZZLE
*
*
*
**
*If six thousand six hundred and six dollar is written as $6,606, then write
eleven thousand eleven hundred and eleven dollars.*
*
*
*Update Your Answers at* : Click
Herehttp://dailybrainteaser.blogspot.com/2011/05/fun-math-puzzle-13-may.html?lavesh=lavesh
Solution:
http://anandtechblog.blogspot.com/2010/11/find-next-higher-number-which-has-same.html
On Thu, May 12, 2011 at 10:52 PM, ArPiT BhAtNaGaR
arpitbhatnagarm...@gmail.com wrote:
if u knw the no. of 1's in no .
I mean can afford the complexity of finding no. of 1's of no.
den if no of 1'
in say
Hi All,
A* search with consistent heuristics is supposed to ensure that an
optimal path to a repeated state is always the first path generated,
but consider the following example:
/---4---A(h=15)--30--\
S(h=18)G (h=0)
\
$12,111.
Dave
On May 13, 11:58 am, Lavesh Rawat lavesh.ra...@gmail.com wrote:
*FUN MATH PUZZLE
*
*
*
**
*If six thousand six hundred and six dollar is written as $6,606, then write
eleven thousand eleven hundred and eleven dollars.*
*
*
*Update Your Answers at* : Click
@Ashish: Here's addition, subtraction, and multiplication with bit
manipulation and comparisons. I doubt if you can do them without
comparisons.
int add(int x, int y)
{
int c;
while(y)
{
c = x y;
x ^= y;
y = c 1;
}
return(x);
}
int sub(int x, int y)
I have an answer for my own question:
I think I've misunderstood the statement in the book, which says:
...to ensure that the optimal path to any repeated state is always the
first one followed.
in the above example, we haven't actually started to follow (expand) G
yet, so the statement about
Given a set of numbers eg:{2,3,6,7,8} . any one who is playing the
game can score points only from this set using the numbers in that
set. given a number, print all the possible ways of scoring that many
points. Repetition of combinations are not allowed.
eg:
1. 6 points can be scored as
6
3+3
Consider the first fit strategy for online bin packing.
So if you have N bins numbered 1, 2, 3..N and you are given value V,
you scan them from left to right and insert V into the first bin that
currently has enough capacity.
In the naieve case, N insertions will take O(N^2) time.
How can this
Let there be n elements v1, v2, v3 .. vn
Let S(i,k) mean - Sum k exists in a subset of {v1, v2, v3, ... vi}
At any given time, if solution has not yet been found then :
S(i,k) = S(i-1,k-vi) + vi or no solution exists
We need to find S(n,k)
So in a systematic fashion, solve S(1,1), S(1,2),
Dear Eric,
Initially, we just at the border node S (18).
After expanding the node S, the border is with A (19), B (22).
Node A is the smallest of the border.
After expanding A, the border is with B (22), G (34)
Node B is the smallest of the border.
After expanding B, the border is with G
Consider a series in which 8 teams are participating. each team plays
twice with all other teams. 4 of them will go to the semi final.How
many matches should a team win, so that it will ensure that it will go
to semi finals.?
--
You received this message because you are subscribed to the Google
Given an array A[i..j] find out maximum j-i such that A[i]a[j] in
O(n) time.
--
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
Cartesian trees could also help.
Cartesian tree takes O(n) time to build, and if you have the count of how
many nodes are there in a tree rooted at any node, by just having the index
of the element also stored there. Once the cartesian tree is built, just
traverse from the root and find how many
12111 = 11000+1100+11
On Fri, May 13, 2011 at 10:28 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*FUN MATH PUZZLE
* * ***
*
*
**
*If six thousand six hundred and six dollar is written as $6,606, then
write eleven thousand eleven hundred and eleven dollars.*
*
*
*Update Your Answers
Guard value error.
L[n1]=;
R[n2]=999;
R[n2] may be merged and counted, if L[1..n1-1] has 999.
On 2011-5-12 19:18, Akshata Sharma wrote:
I tried to solve this problem using merge sort logic, the algorithm is
same as merge sort, only change is in the merge step where i am
@Terence:
I dont know what a guard value error is, but by mistake I wrote R[n2] =
999, should be one more 9 since array value can be =10^7. May be test
cases have values less than 999 that got me AC.
On Thu, May 12, 2011 at 5:20 PM, Terence technic@gmail.com wrote:
Guard value
@Topojoy Biswas:
If A = [3, 1, 5, 2, 4] then CT (A) is:
1
/ \
3 2
/ \
54
counting the number of nodes in the tree rooted at each node,
1(5)
/\
3(1) 2(3)
/ \
5(1) 4(1)
where the numbers in () denotes the number of nodes in tree rooted at that
node.
Once
34 matches
Mail list logo