i think this problem is not a generic sorting problem bcos we already know
the "sorted order"
thru inorder traversal(O(n) time and O(1) space).
the problem is having known the sorted order, how do u "rearrange" the
array.
while i dont have any solution, we cannot dismiss this problem since its
not
@NUPUL Did you describe an algorithm?
On 3/14/07, NUPUL <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Mar 13, 11:55 pm, "Karthik Singaram L" <[EMAIL PROTECTED]>
> wrote:
> > I agree with you completely but for the problem that I posted it is
> > enough that we have O(n) in accessing the elements in orde
On Mar 13, 11:55 pm, "Karthik Singaram L" <[EMAIL PROTECTED]>
wrote:
> I agree with you completely but for the problem that I posted it is
> enough that we have O(n) in accessing the elements in order. Your
> solution does better by calculating every element in O(1) time. The
> key now is to do
hi Peri,
you can't use this
int number
int array[number];
and also wat is the value of "number"?
array size should be constant.
example
int array[10];
if you not sure about array size initially and need to assign at run
time then you need to allocate it as dynamic.
you can do something like thi
I agree with you completely but for the problem that I posted it is
enough that we have O(n) in accessing the elements in order. Your
solution does better by calculating every element in O(1) time. The
key now is to do the actual sorting with this method
--~--~-~--~~~-
On 3/14/07, Karthik Singaram L <[EMAIL PROTECTED]> wrote:
>
>
> @atamyrat:
>
> There is actually a simpler logic to perform inorder traversal in
> constant space and O(n) time. Just keep track of the previous node you
> have visited and the current node. Now If you are coming from the top
> go left
@atamyrat:
There is actually a simpler logic to perform inorder traversal in
constant space and O(n) time. Just keep track of the previous node you
have visited and the current node. Now If you are coming from the top
go left. If you are coming from left down go the right. If you are
coming from
The question is not to print out a sorted array which we can easily do
by inorder traversal. The question is to store the sorted array in the
same array with constant extra space.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goo
if we can get an array of size n then no need to do this much complex...
we can make inorder treversal and get the sorted array
On 3/13/07, Atamurad Hezretkuliyev <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I've been working with this problem and now i'm stuck.
>
> First of all, I assume N is in
Hi,
I've been working with this problem and now i'm stuck.
First of all, I assume N is in in the form 2^x-1, i.e. complete binary tree
With Inorder (L-n-R) traversal of binary tree we can print elements in
sorted order but
i couldn't use it to sort in-place within space&time bounds.
void trave
the LP:
v1 <= 40
v2 <= 30
v3 <= 20
v1 + v2 + v3 <= 60
v1*2 + v2*1 + v3*3 <= 100
Maximize: v1*1000 + v2*1200 + v3*12000
Here v1, v2 and v3 are the volumes of the materials 1, 2 and 3 to be taken.
--~--~-~--~~~---~--~~
You received this message because you are subs
To make things more easier just assume a complete binary search tree
--~--~-~--~~~---~--~~
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 unsubsc
And ofcourse radix sorts take o(nk) ...There is an O(n) algorithm for this
problem in constant 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
A heap is a much more relaxed data structure than a binary search tree. Note
that in a heap there is only relation between the parent and the siblings.
Whereas in a binary search tree there exists a relationship between siblings
also.
--~--~-~--~~~---~--~~
You recei
think twice
if the chosen one is a liar, you cannot complete this algorithm within 198
questions
2007/3/13, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
>
>
> Choose any one at random.
> Ask the remaining 99 prof. about him. you can easily fine whether he
> is a liar or not
>
>
> >
>
--~--~-
Choose any one at random.
Ask the remaining 99 prof. about him. you can easily fine whether he
is a liar or not
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send e
what varibales (how many of them) do i need to define for this problem
to write a linear program that optimizes revenue with this
constraints:
we have a ship that can carry a maximum weight of 100 tons of cargo
and a maximum volume of 60 cubicmeters. we have three materials to be
transported, and
17 matches
Mail list logo