is it possible to do without any extra space...
--
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
now its clear.. thank you..
--
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
I don't think so, I've have wriiten a kart-trie:
http://sourceforge.net/projects/kart-trie which is basically a patricia-tree
or radix-tree. Such a tree has maximum 2 leafs at each branch whilst a
suffix-tree can has more then 2 leafs at each branch (BTW. can you explain
to me what does edge means
Can anyone suggest a sorting algorithm that sorts in linear time without
using extra space.
--
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
Count sort..
From: Subhranil Banerjee riku...@gmail.com
To: algogeeks@googlegroups.com
Sent: Mon, August 23, 2010 3:36:12 AM
Subject: [algogeeks] Sorting algorithm
Can anyone suggest a sorting algorithm that sorts in linear time without using
extra space.
Time is measured in O(n^2) where n is the size of the string.
Quicksort can do in O(n * log(n)) but it uses extra spaces on the
stack, as most sorting method using recursion.
On Aug 23, 12:36 pm, Subhranil Banerjee riku...@gmail.com wrote:
Can anyone suggest a sorting algorithm that sorts in
Five pirates (of different ages) have 100 gold coins to divide
amongst themselves. They decide on the following approach to determine
how much each pirate receives:
The eldest pirate proposes an allocation. All pirates (including the
eldest) then vote on the proposal. If the majority accept the
I think the first 3 methods of the total 4 specified at
http://www.rawkam.com/?p=168
will be applicable for sorting arrays with 0,1 2
On Mon, Aug 23, 2010 at 11:07 AM, Jameel Mohamed
jameel.moha...@gmail.comwrote:
Use counting sort. time complexity is O(n)
On Aug 22, 1:11 pm, AlgoBoy
yes we can
a possible solution what i can think is
treat 12 (same entity )
and 0 as other so in first pass we will short array which will have (all
zeros first , then 12 in some random order )
take index number of zero then in second pass short for 1 2
still O(n) but takes 2 pass
On Mon, Aug
Perform inorder traversal and store in an array.
low = 0, high = size-1
while(low=high)
{
if ( a[low] + a[high] sum)
low++;
else if (a[low] + a[high] sum)
high--;
else
return a[high] and [low]
}
On Mon, Aug 23, 2010 at 9:29 AM, R.ARAVINDH aravindhr...@gmail.com wrote:
@giri:
can
Refer Dutch National Flag Algorithm
On Mon, Aug 23, 2010 at 12:10 PM, Manjunath Manohar
manjunath.n...@gmail.com wrote:
is it possible to do without any extra space...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Hi,
Could anyone help me representing linked list in the form a binary
tree ?
Thanks !!
--
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
I am not sure if I am repeating the answer:
The problem will reduce to find the pair of elements which will sum up to a
particular number. Then read the below article,
http://www.rawkam.com/?p=345
On Mon, Aug 23, 2010 at 9:29 AM, R.ARAVINDH aravindhr...@gmail.com wrote:
@giri:
can u post
Comparison Sort Algorithms cannot sort in linear time(
http://www.rawkam.com/?p=886) so we have to use some non-comparison sorting
algorithm like Counting Sort,Bucket Sort, Radix Sort etc.
But all the non-comparison sort algorithms requires the input to be in a
particular order. (For example:
Yes, it is possible in one pass without extra memory, I think this is a CLRS
exercise problem.
It is possible in one pass without using extra memory.
Keep the 0's at left and 2's at right and scan the middle portion from left
to right and if you see 0 keep at left side and if you see 2 keep it
@sathiah..i can get u ..but dont seem to understand the part where in we
must keep track of the 1's...can u pls post the code..
--
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
This is not a computer problem. Think about it backwards.
If there are only 2 pirates left, then the elder can claim all 100
coins, at worst the vote will be tied, and so he survives and takes
100 coins.
If there are 3 pirates left, then the oldest can claim 99 coins and
give the youngest 1
Actually, a linear data structure like a linked list is also a
specific kind of tree structure.
2010/8/23 Raj N rajn...@gmail.com:
Hi,
Could anyone help me representing linked list in the form a binary
tree ?
Thanks !!
--
You received this message because you are subscribed to the Google
Right. If there is a O(n) sort that uses only constant space, I'd
love to hear about it. Radix sort, bucket sort, counting sort all
need O(n) space.
On Aug 23, 7:02 am, varun bhatia varunbhatia@gmail.com wrote:
Who said count sort does not uses extra space???
As faras I know, it does
@Tanveer: Count sort is not in place. uses extra memory
On Mon, Aug 23, 2010 at 4:32 PM, varun bhatia varunbhatia@gmail.comwrote:
Who said count sort does not uses extra space???
As faras I know, it does need extra space to need thr frequency of each and
every element within a given
Here's my try:
The following function returns the rectangle number given the dimensions of
the rectangle.
int FindRectangleNumber(int row, int colm)
{
if (row == colm)
return row;
if (row == 1)
return colm;
if (row%2 == 0 colm%2 == 0)
return 2*FindRectangleNumber(row/2, colm/2);
if
What will be the representation. How do you define left and right pointers
of the tree for a linked list.
On Mon, Aug 23, 2010 at 10:35 PM, Yan Wang wangyanadam1...@gmail.comwrote:
Actually, a linear data structure like a linked list is also a
specific kind of tree structure.
2010/8/23 Raj N
Dat's Inplace count sort
--
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 options,
What do you exactly mean? You want to represent a linear structure by
using a tree structure?
You can imagine a linked list as a tree with all its root and inner
nodes only having one descendent/child node.
On Aug 23, 10:50 am, Raj N rajn...@gmail.com wrote:
What will be the representation. How
I find an easier non-recursive solution to compute the rectangle
number (represented as RN) of an h x w rectangle (which has a height
of h units and a width of w units):
Situation 1. if (h and w are coprime) or (h = 1) or (w = 1), then RN =
h + w - 1
Situation 2. if h and w are not relatively
Write here again:
I find an easier non-recursive solution to compute the rectangle
number (represented as RN) of an h x w rectangle (which has a height
of h units and a width of w units):
Situation 1:
If (h and w are coprime) or (h = 1) or (w = 1)
then RN = h + w - 1.
Situation 2:
if h and w
Write here again:
I find an easier non-recursive solution to compute the rectangle
number (represented as RN) of an h x w rectangle (which has a height
of h units and a width of w units):
Situation 1:
If (h and w are coprime) or (h = 1) or (w = 1)
then RN = h + w - 1.
Situation 2:
If h and w
27 matches
Mail list logo