Convert a max heap to min heap
--
thanks
--mac
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
You may use usual linear algorithm for constructing heap.
Simply adjust the heap property for all internal nodes.
On 20 окт, 11:47, MAC macatad...@gmail.com wrote:
Convert a max heap to min heap
--
thanks
--mac
--
You received this message because you are subscribed to the Google Groups
Is there any additional condition saying if last 'n' characters of
first list should match with first 'n' characters of 2nd list ?
On Oct 7, 12:52 pm, snehal jain learner@gmail.com wrote:
There are two linked list, both containing a character in each node.
If one linked list contain
On Wed, Oct 20, 2010 at 5:11 AM, Kishen Das kishen@gmail.com wrote:
In the below code the jth and kth inner for loops can be run in parallel
making them O(1) and the entire thing O(n).
for ( i=0 to i=N-1 )
{
for ( j = i to j = 0 ) {
why till 0?
if S=107 , P= 210
and array is 10,
@juver++ - could u plz elaborate..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
@Anirvana - In context to the XOR method u suggested, could u plz
explain why does it so happen.. ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this
@ligerdave -
your algo will fail in the case the two arrays are:
hellostl
eeelexander
ans : hellostlexander
but according to ur method the answer would end up being
hellostleeelexander
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
Use C++ bitset class. It requires O(MaxValue / 8) bytes to represent
set of integers with maximum number is MaxValue.
To find repeated number:
Iterate over the array. For each number check if it is already
inserted into a bitset.
If yes, then we find duplicated element. Otherwise, insert current
Suggested approach by Anirvana doesn't work for this problem.
It's ok if array contain numbers that are repeated twice except one
element and we need to find it.
For this version solution is simple - iterate over elements and find
it's XOR value, so result = a[0] XOR a[1] ... XOR a[n - 1].
Hi to all,
this is my first post here and i hope i can find an answer to my
problem as well as to contribute, whenever possible, to
this group!
I have to solve the following problem:
given an integer number of N bits (we can assume that N is = 32 bit),
which we will call ID, i have to compute
AISHWARIYA LATEST HOT PICS
http://babes-devi.blogspot.com/2010/10/aish-latest-pics.html
SOUTHACTRESS IN A SEXY TOWELS
http://babes-devi.blogspot.com/2010/10/south-actress-in-sexy-towels.html
UDAYATHRA IN A BATH ROOM
@rahul the code doesn't fail for the case you gave. Please check.
Also Kishen can you explain how is the complexity for two loops runninf in
parallel equal to O(1).
On Wed, Oct 20, 2010 at 3:06 PM, rahul patil
rahul.deshmukhpa...@gmail.comwrote:
On Wed, Oct 20, 2010 at 5:11 AM, Kishen Das
@Kishen: Plz explain the complexity...
On 10/20/10, Lily Aldrin lily.hi...@gmail.com wrote:
@rahul the code doesn't fail for the case you gave. Please check.
Also Kishen can you explain how is the complexity for two loops runninf in
parallel equal to O(1).
On Wed, Oct 20, 2010 at 3:06 PM,
i wanna get a clear picture of this before start.
when you say min length of contiguous sub of an array
let's say array A=[3,1,2,3,4,5], N=6
are below both good solutions?
A[0] to A[m] where m=N
A[i] to A[m] where i=m m=N
On Oct 19, 3:58 am, Abhishek Kumar Singh iiita2007...@gmail.com
wrote:
@Kishen
as long as you have one for loop in another, you wont have O(n). it
will most likely run O(n^2)
On Oct 19, 7:41 pm, Kishen Das kishen@gmail.com wrote:
In the below code the jth and kth inner for loops can be run in parallel
making them O(1) and the entire thing O(n).
for ( i=0 to
what if two elements are not next to each other. would it work?
On Oct 20, 8:19 am, juver++ avpostni...@gmail.com wrote:
Suggested approach by Anirvana doesn't work for this problem.
It's ok if array contain numbers that are repeated twice except one
element and we need to find it.
For this
i am getting wa for https://www.spoj.pl/problems/FREQUENT/
here is my code i have used segment trees it would be great if someone
could give me a test case for which my code gives wa.
Thanks in advance.
#includeiostream
#includevector
#includefstream
#includemath.h
Just add the number of the array and let the sum is S. Its complexity is
O(n).
Now XOR all elements of the array and say the result is X_SUM.Its complexity
is O(n).
Now the duplicate element is = (S - X_SUM)/2
On Wed, Oct 20, 2010 at 4:14 PM, Asquare anshika.sp...@gmail.com wrote:
@Anirvana -
for ( i=0 to i=N-1 )
{
// This inner for-loop can be run in parallel, as there is no dependency wrt
previously computed values or the values at other indices.
// you are just blindly adding the value at A[i] to all the elements of the
sub-array B[0 - j ] and hence can be run in parallel.
for ( j
Hello Ayush,
If you really want to work and learn something, I would suggest select an
open source project according to interest and do something as your Btech
Project.
On Wed, Oct 20, 2010 at 4:20 AM, Ayush Mittal ayushmittal2...@gmail.comwrote:
hello friends.
plz suggest
Well, looks like people are not understanding when I say run a loop in
parallel !!!
Please look at some of the examples on Nvidia website on how computations
can be parallelised in OpenCL or CUDA.
And also some of the high level programming languages like Scala which is
also providing these
I am running my algorithm for your values -
I will just show it for sum.
Array B [ 0 0 0 0 0 ]
i = 0
Array B [ 10 0 0 0 0 ]
i = 1
Array B [7 -3 0 0 0 ]
i = 2
Array B [ 9 -1 2 0 0 ]
i=3
Array B [ 116 104 107 105 0 ]
You will stop here and the answer is the range [ k to i ] which is A [ 2 to
3 ]
I
@Mahesh: Let's try this on 1, 2, 3, 4, 4. Then S = 14 and X_SUM = 0.
But the duplicate element is 4, not (14-0) / 2 = 7.
Dave
On Oct 20, 5:49 am, Mahesh_JNU mahesh.jnumc...@gmail.com wrote:
Just add the number of the array and let the sum is S. Its complexity is
O(n).
Now XOR all elements of
Considering sequence 1, 2, 3, 4, 4 and n = 5
lets have missing number as X and repeated number as Y.
(1*2*3*4*4)/n! = 4/5=Y/X = 5Y = 4X = Y=4X/5
(sum of all numbers) + X - Y = n(n+1)/2.
14 + X - Y = 15
X-4X/5=1
X = 5 --- missing value is 5.
Y = 4 -- repeated value.
On Wed, Oct 20, 2010 at
@Karthik: There was no requirement that the numbers be between 1 and
n. Only positive and one number is repeated. So 1, 9, 11, 1 also is
valid input, with expected output 1.
Dave
On Oct 20, 11:30 pm, karthik asok karthika...@gmail.com wrote:
Considering sequence 1, 2, 3, 4, 4 and n = 5
lets
25 matches
Mail list logo