i dont think it is specific for array implimentation of stacks.
Sriram.
On 5/6/06, akshay ranjan <[EMAIL PROTECTED]> wrote:
isn't this specific for array implementation of stack onlyits written in the original ques that no assumptions about the implementation are to be made
On 5/5/06, harsh
I am interested in one of the problems that I encountered in one of the
server for programming contest but I could not solve it for a long
time.
Given small number (<=10) of DNA disease segments (of characters
A,G,T,C) of small length <=10, ask how many DNA sequences of a given
length (<=2000
isn't this specific for array implementation of stack onlyits written in the original ques that no assumptions about the implementation are to be madeOn 5/5/06,
harsh <[EMAIL PROTECTED]> wrote:
This is clearly O(N*N)I will give you an O(N*log(N)) algorithm..Stack sort(Stack S, int N){// N
hi geeks...
my query is
1. if the user presses 1,0 should be printed and if the user presses
0,1 should be printed.
2. no usage of conditional statements.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm
Errata: Should be j in place of i in the condition statement of the for
loop.
and arr[j]=0 should come before arr[i]=0;
Here's the correct code.
void sort(int arr[])
{
for(int i = 0, j = 0; jhttp://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---
void sort(int arr[])
{
for(int i = 0, j = 0; ihttp://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---
Manu wrote:
> Median of 2 combined array X[1...n] and Y[1...n] sorted.
> Find o(lgn) algo to find the median of all 2n elements in the 2 array.
>
> Well I tried and came up with this solution...if somebody has some
> other way plz tell..thnx in advance
>
> we cann't use merging and then find t
W Karas wrote:
> Manu wrote:
> > I know counting sort can do in linear time but we dont need to use and
> > extra space.
> > as we do in case of counting sort.
> >
> >
> > I came up with this sol. but i think it's not stable so if u can find a
> > stable algo plzzz
> >
> >
> > i=0;j=n-1;
> >
oops i made mistake sorry for that
void sort(int *a)
{
for(int i = 1, j = 0; i a[i])
swap(a[i],a[j]);
j++;
}
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" gro
Manu wrote:
> I know counting sort can do in linear time but we dont need to use and
> extra space.
> as we do in case of counting sort.
>
>
> I came up with this sol. but i think it's not stable so if u can find a
> stable algo plzzz
>
>
> i=0;j=n-1;
>
> while(i if(a[i]==a[j]) {
>
Hi negi!
forget abt stable sort, your code wud not even do simple sort.
e.g. try
your code on a[]={0,1,0} , it doesn't sort it as a[j] never > a[i].
cheers,
siva.On 5/5/06, Cool_Happy <[EMAIL PROTECTED]> wrote:
i think this sort the array in linear time..if this snippet has a
hi matia ... i think the code you have written sounds good..
but it is not sorting the array it is a kind of counting number of 1
and 0...
how ever you can write a simple code like
int one =0; zero =0;
for (i=0;ihttp://groups.google.com/group/algogeeks
-~--~~~~--~
Hi Mattia,
what u have is just counted the number of 0 and 1 in the given array
but u haven't sorted them.
what i want u is to sort the array and the sorting should be stable
sort as in the case of counting sort.
Bye
--~--~-~--~~~---~--~~
You received this message
i think this sort the array in linear time..
if this snippet has any error do let me know..
void sort(int *a)
{
for(int i = 1, j = 0; i a[i])
{
swap(a[i],a[j]);
j++;
}
}
}
--~--~-~--~~~---~--~~
You received
I've searched the google scholar, but find no links.
I'm wondering where can I find this paper.
This is the first paper in heapsort and is published in Communications
of the ACM, 1964
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
On 5/5/06, Manu <[EMAIL PROTECTED]> wrote:
> I know counting sort can do in linear time but we dont need to use and
> extra space.
> as we do in case of counting sort.
if the array values are only 0 and 1, assuming that the array contains
at best 255 elements, counting sort would need only 3 bytes
I know counting sort can do in linear time but we dont need to use and
extra space.
as we do in case of counting sort.
I came up with this sol. but i think it's not stable so if u can find a
stable algo plzzz
i=0;j=n-1;
while(ihttp://groups.google.com/group/algogeeks
-~--~~---
Median of 2 combined array X[1...n] and Y[1...n] sorted.
Find o(lgn) algo to find the median of all 2n elements in the 2 array.
Well I tried and came up with this solution...if somebody has some
other way plz tell..thnx in advance
we cann't use merging and then find the median cause that wil
what you think about radix sort here.
Kapil
--~--~-~--~~~---~--~~
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, s
iwgmsft wrote:
> How would you create a program that simulated the behavior of a single
> ant that could most effectively navigate its way across a particular
> difficult trail?
http://groups.google.com/groups/search?q=following+line+group%3A*robotics*
--~--~-~--~~~
20 matches
Mail list logo