There are a number of integer ranges say [ L, R]i denoting left and
right of segment i, lets says we are given K such segments and we
define one operation as move which makes our chosen segment to move
either +1 or -1 so after
move(i, +1) segment i will be [L+1, R+1]. There are some particular
could you please explain the question in a bit more detail?
especially the partThere are some particular
numbers which are made using 4 or 7 : any combination of 4 and 7 are
accepted.
from what i understand of the question, there are some intervals given...
we can move the intervals left or right
+1
On Sun, Oct 30, 2011 at 6:53 AM, Siddhartha Banerjee
thefourrup...@gmail.com wrote:
could you please explain the question in a bit more detail?
especially the partThere are some particular
numbers which are made using 4 or 7 : any combination of 4 and 7 are
accepted.
from what i
Your algo does not maintain the stability
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/wPJiswbpjk8J.
To post to this group, send email to
@Narain : There algorithm does not maintain the stability..
Test for: {2,4,3,1,5,6}
output: {2,4,6,1,5,3}
Abhishek Khattri
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@khattri:thanks :) i thought it was correct.
--
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
@rShetty.. ture.. the pivot element iteration doesn't maintain stability..
O(n) with O(n) seems to be better approach. -- pushing all elements into a
two linked lists.. and joining them in the end.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
@atul: can u pls explain ur code...?
On 7/22/11, Puneet Gautam puneet.nsi...@gmail.com wrote:
@atul: thanks..!
On 7/22/11, atul purohit gonewiththe...@gmail.com wrote:
@puuneet
http://en.wikipedia.org/wiki/Sorting_algorithm#Stability
On Fri, Jul 22, 2011 at 10:57 AM, Puneet Gautam
@atul: can you please elaborate the algorithm you are using.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/mLtfUz77JMIJ.
To post to this group, send email
@atul: can u pls tell me how did u go about solving this in ur mind..?
On 7/22/11, Abhi abhi123khat...@gmail.com wrote:
@atul: can you please elaborate the algorithm you are using.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view
@atul
Your algo is not stable
http://www.ideone.com/DrV5J
BTW what are u trying to do
instead of posting a code please prefer posting a simple algorithm in text
coding part is very easy once the correct algorithm is found
On Fri, Jul 22, 2011 at 11:43 AM, Puneet Gautam
The approach by atul is maintaining partitions of array such that element
left to it are even and right odd.Its an implementation of quick sort as
discussed earlier.Its o(n) no doubt but its not stable.
On Fri, Jul 22, 2011 at 11:51 AM, sunny agrawal sunny816.i...@gmail.comwrote:
@atul
Your
right..
To do it in O(n) we will need O(n) extra space.
and without extra space we can use a divide and conquer approach with O(lgn)
stack space
On Fri, Jul 22, 2011 at 12:04 PM, saurabh singh saurab...@gmail.com wrote:
The approach by atul is maintaining partitions of array such that element
Anybody try for maintain the stable of elements in O(n) as like
Input is :{1,2,3,4,5,6,7}
then Output should be
(2,4,6,1,3,5,7)
not..
{2,4,6,1,5,3,7} base on above discussion ..
--
You received this message because you are subscribed to the Google Groups
Algorithm
@sunny: how do u do it by Divide n conquer ...can u provide the algo...?
On 7/22/11, UMESH KUMAR kumar.umesh...@gmail.com wrote:
Anybody try for maintain the stable of elements in O(n) as like
Input is :{1,2,3,4,5,6,7}
then Output should be
(2,4,6,1,3,5,7)
not..
Divide and Conquer Algorithm : Just like merge Sort of Quick sort...we
just need to modify the merge step of merge sort or Partition step of Quick
sort
lets call our this method Arrange();
//just as merge step takes two sorted arrays and make one completely sorted
one
it takes 2 arrays which
For people who like the generic way,its merge sort only difference is where
comp(a,b) returns true when a%2=1a%2=0.
Rest its same.
On Fri, Jul 22, 2011 at 1:12 PM, sunny agrawal sunny816.i...@gmail.comwrote:
Divide and Conquer Algorithm : Just like merge Sort of Quick sort...we
just need
@sunny: got dat...
On 7/22/11, saurabh singh saurab...@gmail.com wrote:
So many why's..:)
I was just trying to explain the queries about the divide and conquer asked
above.+1 to u sunny.
On Fri, Jul 22, 2011 at 1:26 PM, sunny agrawal
sunny816.i...@gmail.comwrote:
Yes thats true,
but
@Sunny: Excellent explanation ( solution) !!
--
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
an O(n) soln
traveres the array...as you receive odd number put that index in
queuewhen received an even numb check if queue is empty or
not...if queue is empty the do nothing else swap with the head of the
queue
hope it worksit also maintains the stability of aarray...
On Fri, Jul
oh sorry for above soln...it will require many passes and hence inefficient...
On Fri, Jul 22, 2011 at 9:02 PM, Gaurav Popli abeygau...@gmail.com wrote:
an O(n) soln
traveres the array...as you receive odd number put that index in
queuewhen received an even numb check if queue is empty or
O(n) solution:
odd_index=-1;
even_index=-1;
//now find first odd no.'s index
for(i=0;in;i++)
if(a[i]%2!=0)
{
odd_index=i;
break;
}
//if odd_index==-1 return; (only even no.s are there)
//select any even no.'s index after odd_index and swap
for(i=odd_index+1;in;i++)
Hi
Given an array A[], write a function to separate even and odd numbers
(i.e., put all even numbers first than odd numbers) and stability is also
maintain for the elements in the Array.
Eg.
input:
A[] = {12, 34, 45, 9, 8, 90, 3}
output:
A[] = {12, 34, 8, 90, 45, 9, 3}**
Thanks
--
You
Div n Conquer O(nlogn)
Thanks
--
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
algogeeks+unsubscr...@googlegroups.com.
For
partitioning the element as in quicksort will work
On Thu, Jul 21, 2011 at 11:36 PM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote:
Div n Conquer O(nlogn)
Thanks
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
no partitioning won't maintain stability
divide and Conquer will do in O(nlgn)
On Thu, Jul 21, 2011 at 11:38 PM, santosh mahto santoshbit2...@gmail.comwrote:
partitioning the element as in quicksort will work
On Thu, Jul 21, 2011 at 11:36 PM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote:
scan the array from both the ends..i.e use two pointers to scan the array..
left pointer points at the beginning and right one one at the end..
left pointer can be used to find whether an element is even or not until it
reaches end while right pointer can be used to find whthr a no is odd until
it
small change in the pseudocode..
for (i=0 until i+ a[].length){
if (*leftptr % 2 == 0)
A2[i] = *leftptr ;
else if (*rtptr % 2 == 0)
A2[i+a[].length-1] = *rtptr ;
leftptr++;
rtptr--;
}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
left=0;right=n-1;
while(leftright)
{
while(leftright a[left]%2==0)
left++;
while(leftright a[right]%2==1)
right--;
if(leftright)
{
swap(a[l],a[r]);
l++;
r--;
}
O(n)
On Thu, Jul 21, 2011 at 11:49 PM, Abhishek Sharma
here in O(n) and stable
void swap (int *a,int *b) {
int t;
t=*a;
*a=*b;
*b=t;
}
int main(void) {
int a[] = {12, 34, 45, 9, 8, 90, 3},odd=0,even=0,n=7;
while(oddn even n) {
if(a[even]%2==0){
if(odd==even)
odd++;
even++;
What is meant by maintaining the stability...?
pls tell me...!!
Thanks.
On 7/22/11, atul purohit gonewiththe...@gmail.com wrote:
here in O(n) and stable
void swap (int *a,int *b) {
int t;
t=*a;
*a=*b;
*b=t;
}
int main(void) {
int a[] = {12, 34, 45, 9, 8, 90,
@puuneet
http://en.wikipedia.org/wiki/Sorting_algorithm#Stability
On Fri, Jul 22, 2011 at 10:57 AM, Puneet Gautam puneet.nsi...@gmail.comwrote:
What is meant by maintaining the stability...?
pls tell me...!!
Thanks.
On 7/22/11, atul purohit gonewiththe...@gmail.com wrote:
here in O(n) and
@atul: thanks..!
On 7/22/11, atul purohit gonewiththe...@gmail.com wrote:
@puuneet
http://en.wikipedia.org/wiki/Sorting_algorithm#Stability
On Fri, Jul 22, 2011 at 10:57 AM, Puneet Gautam
puneet.nsi...@gmail.comwrote:
What is meant by maintaining the stability...?
pls tell me...!!
Hi
Given an array how to find a sequence whose sum is maximum
*but condition is that no two adjacent elements* of the given Array.
ex:- Array:-[3,6,7,10,4]
output:- {6,10}=16
Array::[12,3,5,30]
output:-{12,30}= 42
--
You received this message because you are subscribed to the Google Groups
hey, dis is what i was told by a friend working @ amazon -
Sometimes they do go to the level of the subject basics like OS or DS but
you should be able to tackle these if you had studied well. No separate prep
is needed.
Few Favs DS Algos ( i should get treat for revealing this.;)... )
1) All
Hi geeks,
tomorrow i am having Amazon.com's Coding round followed by
Interview...pls suggest some tips to help me out...
--
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
hello...
QN :- How to find *TRANSPOSE* of the *RECTANGULAR* matrix
i,e. m * n , where n != m.
Ex:-
input:-
1 2 3 4
5 6 7 8
output:-
1 5
2 6
3 7
4 8
thanks and regards
UMESH KUMAR
D.U.
--
You
Hey fellas,
I need to seek some advice from you all.
I have recently developed strong interest in programming problems.
So, What is the best place I should start practicing my skills.
It would be great if the effort is rewarding as well.
Thanks in advance.
TY
--
Neeraj
Ted Turner
www.topcoder.com/tc
www.spoj.pl
On Tue, Feb 2, 2010 at 4:24 PM, Neeraj Singh 17.neera...@gmail.com wrote:
Hey fellas,
I need to seek some advice from you all.
I have recently developed strong interest in programming problems.
So, What is the best place I should start practicing my skills.
www.projecteuler.net has some interesting problems.
On Tue, Feb 2, 2010 at 6:07 PM, sharad kumar aryansmit3...@gmail.com wrote:
www.topcoder.com/tc
www.spoj.pl
On Tue, Feb 2, 2010 at 4:24 PM, Neeraj Singh 17.neera...@gmail.com wrote:
Hey fellas,
I need to seek some advice from you all.
you want it rewarding , go to codechef.com
On Tue, Feb 2, 2010 at 6:30 PM, Anurag Bhatia abhati...@gmail.com wrote:
www.projecteuler.net has some interesting problems.
On Tue, Feb 2, 2010 at 6:07 PM, sharad kumar aryansmit3...@gmail.com
wrote:
www.topcoder.com/tc
www.spoj.pl
On Tue,
rewarding in what sense?
-Rohit
On Tue, Feb 2, 2010 at 8:28 PM, vivek bijlwan viv...@gmail.com wrote:
you want it rewarding , go to codechef.com
On Tue, Feb 2, 2010 at 6:30 PM, Anurag Bhatia abhati...@gmail.com wrote:
www.projecteuler.net has some interesting problems.
On Tue, Feb 2,
i will recommend u usaco training gateway. it is awesome
On Tue, Feb 2, 2010 at 2:54 AM, Neeraj Singh 17.neera...@gmail.com wrote:
Hey fellas,
I need to seek some advice from you all.
I have recently developed strong interest in programming problems.
So, What is the best place I should
try uva online judge
On Tue, Feb 2, 2010 at 8:56 PM, vikas mehta mehta...@gmail.com wrote:
i will recommend u usaco training gateway. it is awesome
On Tue, Feb 2, 2010 at 2:54 AM, Neeraj Singh 17.neera...@gmail.comwrote:
Hey fellas,
I need to seek some advice from you all.
I have
On Tue, Feb 2, 2010 at 8:56 PM, vikas mehta mehta...@gmail.com wrote:
i will recommend u usaco training gateway. it is awesome
On Tue, Feb 2, 2010 at 2:54 AM, Neeraj Singh 17.neera...@gmail.comwrote:
Hey fellas,
I need to seek some advice from you all.
I have recently developed strong
u can also try stackoverflow.com
On Tue, Feb 2, 2010 at 9:38 PM, gaurav gupta 1989.gau...@googlemail.comwrote:
try uva online judge
On Tue, Feb 2, 2010 at 8:56 PM, vikas mehta mehta...@gmail.com wrote:
i will recommend u usaco training gateway. it is awesome
On Tue, Feb 2, 2010 at 2:54
www.spoj.com (sphere online judge)
--
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
Please go through the site http://geeksforgeeks.org/
I recently found the site. This is a great site as this provides well
organized and well coded solutions for generally asked interview/programming
questions
Enjoy!!
Dheeraj
On Tue, Feb 2, 2010 at 9:11 AM, Ashudeep Sharma
uva online judge
-Rohit
On Wed, Feb 3, 2010 at 8:45 AM, Dheeraj Jain dheerajj...@gmail.com wrote:
Please go through the site http://geeksforgeeks.org/
I recently found the site. This is a great site as this provides well
organized and well coded solutions for generally asked
49 matches
Mail list logo