Re: [algogeeks] VIDEO STREAMING

2012-11-24 Thread Kartik Sachan
@surabh sab jagah hath mar liya beywhy don't u help me out...vase bhi
aab toh tum free bhi ho gye ho ge..:P:P

-- 




Re: [algogeeks] INTERVIEW QUESTION

2012-10-26 Thread Kartik Sachan
@payal why u need this..??...:P:P

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Interview question

2012-03-25 Thread Kartik Sachan
+1 @saurabh...:P

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] ITRIX'12 OPC

2012-03-20 Thread Kartik Sachan
+1

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Puzzle

2012-02-27 Thread Kartik Sachan
I think logic is the difference is
2 2 4 2 2 2 8 so next will be 2 2  2 2 2 16

so ans will be 66 68 70


but first number 3 making some problem

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2012-02-17 Thread Kartik Sachan
output depend upon complier how it store floating point number

actualy exactly 0/3 is not stored in memory some 0.299 like this is
stored so its totally implementation dependent..

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj

2012-02-16 Thread Kartik Sachan
 @atul by doing through link list it will give TLEu have to derive some
 kind of formula .. and till now i am unable to find that
 kartik.sac...@gmail.com


-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Array Problem

2012-02-14 Thread Kartik Sachan
if n is less than 10^6 hasing works fine ..and we count in O(1) time only

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2012-02-12 Thread Kartik Sachan
its a compiler depentent...

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output ??

2012-01-09 Thread Kartik Sachan
@amol I think  it is not the behaviour of printf

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Removing same character(s) in a group

2011-12-12 Thread kartik sachan
+1 amol sharma...what u want ??.output should be shown at every
step or u want final ans??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-11-28 Thread kartik sachan
@DAVE that was typing mistake...

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-11-27 Thread kartik sachan
simply find max in o(n) by liner search then remove max then again find max
that will be second max:P :P

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] regarding start of loop in linked list

2011-11-20 Thread kartik sachan
@amol..we can simply break the loop where we find the slow and fast pointer
meeting,then its become a a problem of two link list having common ending
point and different staring point
and for detecting the extact point where loop began is two traverse both
the list and find its length lets say 'a' and 'b' now put 1st pointer at
start position of 1st link list and other pointer at distance of |a-b| from
second list ...now where both of them meet is the point where loop began.

correct me if i am worng ...

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Given a int N, write a function to return the closest Fibonacci Number

2011-11-20 Thread kartik sachan
yup using matrix method we can solve it in O(log(n)).

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] NULL pointer

2011-11-14 Thread kartik sachan
yup.

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] ARTICULATION POINT ALGO

2011-10-23 Thread kartik sachan
PLEASE ANY BODY CAN EXPLAIN ME ARTICULATION POINT ALGO IN DETAIL
PLZ TAKE SOME EXAMPLE TOO
-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: ARTICULATION POINT ALGO

2011-10-23 Thread kartik sachan
yup but didn't get much out of it...

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: fibonicci doubt

2011-10-02 Thread kartik sachan
@rahul if u have to find first 100 even fibonacci term sum

the u have to simply find the t2n+1   term -1

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] ARRAY PROBLEM

2011-09-29 Thread kartik sachan
@AMOL i want array index i.e i to j that will be max subarry which has equal
no of zero and one's


but i think ur soln is not providing this

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] ARRAY PROBLEM

2011-09-29 Thread kartik sachan
ok amol i will do it..but i am unable to convience myself that
this algo will give the desire result

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] ARRAY PROBLEM

2011-09-28 Thread kartik sachan
   Given a binary array ( array containing only 0s and 1s ). You have to
print the sub-array with
maximum number of equal 1s and 0s.
INPUT   OUTPUT
1001110101  0011101


complex-O(n)

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: question

2011-09-22 Thread kartik sachan
@ratan suggest some efficient algo...

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Microsoft Question

2011-09-22 Thread kartik sachan
@dheeraj i didn't get what u want to say explain me with the help of example

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Microsoft Question

2011-09-21 Thread kartik sachan
i think i can solve this in O(n^2)
here is code http://ideone.com/Gk69A

# includestdio.h# includestring.hchar a[100][100];int findword(int
*b,int n,int m){
int i,j,flag=0;
char s[1];
for(i=0;in;i++)
for(j=0;jm;j++)
s[a[i][j]]++;
for(i=0;istrlen(b);i++)
if(s[b[i]]!=0)
s[b[i]]--;
else
{flag=0; break;}
if(flag==0)
return 0;
else
return 1;}int main(){
int i,j,n,m;
char str[1];
scanf(%d %d,n,m);
for(i=0;in;i++)
for(j=0;jm;j++)
scanf(%c,a[i][j]);
scanf(%s,str);
if(findword(str,n,m))
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(word
is there in matrix);
else
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(word
is not there in matrix);return 0;}

plzz correct me if i am worng

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: c output

2011-09-21 Thread kartik sachan
@sukran  if it is undefined in ansi c so it can return any value???
at complilaton.but all time it is giving me same value

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] question

2011-09-21 Thread kartik sachan
http://ideone.com/xRnDo

# includestdio.h# includestring.hvoid findbig(char *a){
int i,j;
int flag=0;
for(i=strlen(a)-1;i0;i--)
if(a[i-1]a[i])
{
char temp=a[i];
a[i]=a[i-1];
a[i-1]=temp;
flag=1;
break;

}
if(flag==1)
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(%s,a);
else
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(NO
number OF SAME DIGITS EXIT\n);
}int main(){
char a[]=7585;
findbig(a);return 0;}

correct me if i am worng

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: c output

2011-09-21 Thread kartik sachan
thanks sukran...
i have one more question evaluation of printf is also undefined in C??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C OUTPUT

2011-09-21 Thread kartik sachan
int main(){
struct {
int a:1;
int b:3;
}obj;
obj.b=12;
obj.a=7;
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(%d
%d,obj.b,obj.a);return 0;}



can anybody explain the output
plzz also show how no's are stored


-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: question

2011-09-21 Thread kartik sachan
obivously it will be first largest 

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C OUTPUT

2011-09-21 Thread kartik sachan
@ravi i think ur concepts is correct the no is stored in 2's formif
negative

thanks ravi

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: question

2011-09-21 Thread kartik sachan
@arya ur code for 7695...giving ans 9765
but ans should be 7965

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Programs

2011-09-19 Thread kartik sachan
@bharatkumar  i think u r  in thinking oder in lexicographic order .but in
question its not the same...

we have print the according to the sentence not according to dictonary

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C Problem

2011-09-19 Thread kartik sachan
+1  to yogesh

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] DS QUESTION

2011-09-18 Thread kartik sachan
given n nodes ,how many different possible tree can be formed??(not
necessary that all are binary treeit could be any tree...)


-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread kartik sachan
@what's special in this ...
it is giving 0 in both cases.
basically a garbage value

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: whats d problem wid using gets?

2011-09-08 Thread kartik sachan
using gets we can get buffer over as gets doesn't check about the size input
so it mai go to that area where our stack base pointer(think in memory
layout section) is stored so our programmed doenn't return to orignal state
as address is stored there...so it is dangeroues to use

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c doubt

2011-08-31 Thread kartik sachan
@ prateek i am still not geeting why now out put is 4
but if we change second bit2:5 then out put again 8
plzz explain throughly

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c doubt

2011-08-31 Thread kartik sachan
becoz int is of 4btyes so 32 bits required

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c doubt

2011-08-30 Thread kartik sachan
@prateek check this i have complied on ideone
http://ideone.com/UV7MG
output is 4 only

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: APTITUDE QUESTIONS

2011-08-30 Thread kartik sachan
for 1st question ans will be a,b,e as (125)^1/3 is 5 sum is 8
for 2nd question we see pattern in 7 power i.e 7,9,3,1 and this pattern
reapeats for inerval of 4
and second term of of any power of 7=2 is 4
so diff is 5
ans will be 5


how to find the ans of third question??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Explanation

2011-08-29 Thread kartik sachan
see the out put will the help of gcc -E.u will get ur ans

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ ACODE

2011-08-28 Thread kartik sachan
THANKs amol piyush i got my mistake

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c doubt

2011-08-28 Thread kartik sachan
@PRATEEK if i make int bit1:2 then it will store 2 bytes
for example if bit1=4;then out will be 0 or 1
my question is  it storing number from least significant bit or most
significant bit???
suppose for 4 0100 so out will be 00 or 01??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-28 Thread kartik sachan
it can be simply done in O(sqrt(n))

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: SPOJ ACODE

2011-08-27 Thread kartik sachan
koyi to test cases de jisme mera code fail kare?

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ ACODE

2011-08-27 Thread kartik sachan
thanks piyush for replying but i don't have complier for java and i don't
know even java

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SPOJ ACODE

2011-08-26 Thread kartik sachan
i am getting repeatdly WA in this question link is
https://www.spoj.pl/problems/ACODE/


plzz provide me some test cases where my code
fails.



my code is

# includecstdio
# includecstring
int main()
{

while(1)
{
char a[50100];
scanf(%s,a);
   int l1=strlen(a);
if(a[0]=='0')
break;
long long int i,j,k=0;
for(i=l1-1;i=0;i--)
a[i+1]=a[i];
long long int dp[50100]={0};
dp[0]=1;
dp[1]=1;
for(i=2;i=l1;i++)
{
long long int s=(a[i-1]-'0')*10+(a[i]-'0');
if(a[i]!='0's=0s=26a[i-1]!='0')
dp[i]=dp[i-1]+dp[i-2];
else
dp[i]=dp[i-1];
}
for(j=0;j=i;j++)
{
a[j]='\0';}
printf(%lld\n,dp[i-1]);
}
return 0;
}

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread kartik sachan
any body tell the test cases??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread kartik sachan
thanks nitin got AC...:) silliy mistake

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SPOJ CENCRY

2011-08-09 Thread kartik sachan
this is my codeplz give me any test case where my code
fails.i am reaptedly getting WA

link is https://www.spoj.pl/problems/CENCRY/

# includecstdio
# includecstring
char a[]=aeiouaeiouaeiouaeioua;
char b[]=bcdfghjklmnpqrstvwxyz;
int search(char a1)
{
int i;
if(a1=='a'||a1=='e'||a1=='i'||a1=='o'||a1=='u')
{
for(i=0;i5;i++)
if(a1==a[i])
{return i;break;}
}
else
{
for(i=0;i22;i++)
if(a1==b[i])
{return i;break;}
}
}


int main()
{

int l1=strlen(a);
int l2=strlen(b);

char c[6];
int t;
scanf(%d,t);
int j;
for(j=0;jt;j++)
{   int d[1000];
int pos=0;
scanf(%s,c);
int i;
for(i=0;i200;i++)
d[i]=-1;
for(i=0;c[i]!='\0';i++)
{
d[c[i]]++;
pos=search(c[i]);

if(c[i]=='a'||c[i]=='e'||c[i]=='i'||c[i]=='o'||c[i]=='u')
{
printf(%c,b[(pos+d[c[i]]*5)%21]);
//printf(  %d\n,(pos+d[c[i]]*5)%21);
}
else if (d[c[i]]==0)
printf(%c,a[pos]);
else
printf(%c,a[pos+(d[c[i]]*21+d[c[i]])%21]);
}
printf(\n);
}
return 0;
}

plzz help me..

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] output???

2011-08-05 Thread kartik sachan
the output will be hi

even if u have putted equal to sign there this is becoz 0.7 do not exactly
stored like 0.7 in a but some thing lesser as describe in ASCII format
that's why it is awlays lesser than 0.7

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Duplicates in a string

2011-08-05 Thread kartik sachan
I think in this case count sort type thing would work better way

just take a array of max 26(as 26 CHARACTER ARE THERE)

and using index as count['M']=store how many times M  has comes

similary store other character

now print array whose value 0

but IN this case u might lost the ORDER..(but that can
be done using binary search using T(log(n))


the total time complexcity is O(n)

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread kartik sachan
@priya its some thing like this
for(i=0;a[i]!='\0';i++)
count['a[i]']++;

so its O(n) only

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Give an efficient search algo

2011-08-04 Thread kartik sachan
@amit it's given that array is increasing then decreasing..so where
there is change from incre to drece that value of i in loop will be k

in this we can find out k if not given

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Direct - i ques

2011-08-01 Thread kartik sachan
@ankit i am saying at the time of insertion of first element  to last we
have to maintain a min element which store the min number

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] plz explain

2011-08-01 Thread kartik sachan
i think this will be the only 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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Max subarray of no 2 adjacent elements

2011-08-01 Thread kartik sachan
I think then output should be 17 not 13??
correct me if i am wrong and explain too

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Max subarray of no 2 adjacent elements

2011-08-01 Thread kartik sachan
oh..got it i didn't read that statement:(

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Missing elements

2011-08-01 Thread kartik sachan
similar type algo is there in geeksforgeeks.org in array section from there
u can understand it better way

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Direct - i ques

2011-07-31 Thread kartik sachan
I think its stack  where deletion insertion and finding min (as we will cal
min at the time of insertion only by taking min val ) will take O(1) time

correct me if i am worng...!

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
#include stdio.h
  void foo(const char **p) { }
  int main(int argc, char **argv)
  {
  foo(argv);
  return 0;
  }

why the above code giving me warning can body explain me??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
*@AMOL *sending a normal pointer to a const pointer doesn't give any warning



why this is giving??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ GPA1

2011-07-01 Thread kartik sachan
@thanks ceg sirfinally got acceptedur test
case worked..silly mistake...=  error

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ GPA1

2011-06-29 Thread kartik sachan
@sunny atof(ab) is giving me as zero.so it will not affect
the calculation i think so...

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
GOT AC IN .02 SEC  .:)))

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
@VAIBHAV.ur logic fails in many
cases...like G

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
anonymous u have to play with the index no of either G or
B...and see how many shift it will require to reach it original
postion then max will be the ans..


well GBGBBB
if we start from right to left then G=3 and G=5
first G have reach to 0 pos and second G have to reach to 1 pos
for first it require 2 steps and second require 4 steps

so final ans will 4


u have to think logic for this case too when like this come
GGGGGBGBG

here G come one after other there is one trick for this.u have
to thnik and implement the code is 6 to 8 line only

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
@ vaibhav i have submitted my concept in spoj and it got AC in .02 sec

i am saying for u have to play with index of EITHER of G or B

now u have to think logic by taking two or more exmaple and shift it
in...do it in paperu will see some pattern

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
http://www.spoj.pl/problems/SHLIGHTS/

this is the link

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SPOJ GPA1

2011-06-28 Thread kartik sachan
http://www.spoj.pl/problems/GPA1/

hey guys here is my code and its given WA ...plzz tell me
where i am worng..i am tried getting WA in this question

# includestdio.h
# includestdlib.h

int main()
{
int n;
scanf(%d,n);
while(n--)
{
double a,b,c,d,e,f;
double cpi[20]={0};
double flag[20]={0};
double a1,a2,a3,a4,a5;
char b1[100],b2[100],b3[100],b4[100],b5[100];
int i,j,k,l;
int t;
int ch =0;
scanf(%lf%lf%lf%lf%lf%lf,a,b,c,d,e,f);
for(i=0;i6;i++)
{
scanf(%s%s%s%s%s,b1,b2,b3,b4,b5);
a1=atof(b1);
a2=atof(b2);
a3=atof(b3);
a4=atof(b4);
a5=atof(b5);

//(a1=%lf a2=%lf a3=%lf a4=%lf a5=%lf \n,a1,a2,a3,a4,a5);

float max1,max2;
if(a1a3a2a3)
{max1=a1;max2=a2;}
else if(a1a2a3a2)
{max1=a1;max2=a3;}
else
{max1=a2;max2=a3;}
//printf(max1=%lf max2=%lf\n,max1,max2);
double sum1=((max1+max2)*45)/40;
//printf(SUM1=%lf\n,sum1);
double sum2=a4/2;
double sum3;
if(a551)
sum3=5;
else if(a561)
sum3=4;
else if(a571)
sum3=3;
else if(a581)
sum3=2;
else if(a591)
sum3=1;
else
sum3=0;

double total=sum1+sum2+sum3;
//printf(TOTAL SUM=%lf\n,total);
if(total=91)
{cpi[i]=10;flag[i]=1;}
else if(total=81)
{cpi[i]=9;flag[i]=1;}
else if(total=71)
{cpi[i]=8;flag[i]=1;}
else if(total=61)
{cpi[i]=7;flag[i]=1;}
else if(total50)
{cpi[i]=6;flag[i]=1;}
else if(total==50)
{cpi[i]=5;flag[i]=1;}
else
{cpi[i]=0;flag[i]=0;}

//printf(sum1=%lf sum2=%lf sum3=%lf total=%lf cpi=%d
flag=%d\n,sum1,sum2,sum3,total,cpi[i],flag[i]);
}
float
gpa=(a*cpi[0]+b*cpi[1]+c*cpi[2]+d*cpi[3]+e*cpi[4]+f*cpi[5])/(a+b+c+d+e+f);
//printf(sum= %d\n,a+b+c+d+e+f);
//printf(gpa =%lf\n,gpa);
for(i=0;i6;i++)
if(flag[i]==0)
{
ch=1;
break;
}
if(ch==1)
printf(FAILED, %0.2lf\n,gpa);
else
printf(PASSED, %0.2lf\n,gpa);
}
return 0;
}







plzz help me and correct me where i am wrong

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-28 Thread kartik sachan
if u want code then mail me.

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread kartik sachan
HEY DUDE I AM NOT GETTING UR LOGIC AT ALL I THINK HOW U WILL SATISFY THIS
CASE GBGBBB

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj shlights

2011-06-25 Thread kartik sachan
@jitendra that's what i am asking forwhat algo i should
implement  to get process in 1 sec?

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Segmentation fault

2011-06-23 Thread kartik sachan
@ anonymous  here u see the formula where it is clearly mention for single
step the value of k is not changing

so we can solve this question by taking single dimensional array instead of
two dimensional array

and in 1D array we have large size to store value for DP as compare to 2D
array

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Segmentation fault

2011-06-23 Thread kartik sachan
@saurabh circular link list implementation i think tough as camparision to
single array

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Segmentation fault

2011-06-23 Thread kartik sachan
@anoyomous take array size as a[106]

and dude to intilize array to zero u si,ply write a[106]={0};

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] spoj shlights

2011-06-22 Thread kartik sachan
QUESTION LINK IS http://www.spoj.pl/problems/SHLIGHTS/

MY CODE IS GIVEN BELOW
ITS IS GIVING TLEPLZZ HELP ME OUT

# includecstdio
# includecstring
int main()
{

int t;
char a[17];
scanf(%d,t);
int i,j,k;

while(t--)
{
int count=0;
int flag=0,flag1=0;

scanf(%s,a);
while(1)
{

for(i=0;a[i]!='\0';i++)
if(a[i]=='G'a[i+1]=='B')
{a[i]='B';a[i+1]='G';i=i+1;flag1=1;}
if(flag1==1)
{count++;flag1=0;}
if(count =flag)
break;
flag=count;
}
printf(%d\n,count);
}
return 0;
}



PLZZ HELP ME OUT OR SUGGEST ANY OTHER LOGIC IF IT  HAS SOME MISTAKES

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] finding vlaue of nCr

2011-06-21 Thread kartik sachan
but for big numbers this method is very expensiveand hope
give TLE in 1 sec question where n=1000

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] finding vlaue of nCr

2011-06-21 Thread kartik sachan
@ sunny  i am not getting ur apporach
but i am thinking like this..
taking an array from and intilize it to n to n-r

a[1000];
int k=0;
for(int i=n;i=n-r;i--)
a[k++]=i;

for(int y=n-r;y1;y--)
for(j=0;jk;j++)
if(a[j]%y==0)
{a[j]=a[j]/y;break;}


for example we take 7c3


so first array is intilize to {7,6,5,4}
then we check divisibilty by {3,2}
so 6 is divisible by 3 so put 6/3 back in array 2
so finally 7*2*5*2;

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread kartik sachan
hey sunny suppose u have to calculate 100c50  then there is a lot of chances
of over flow becoz u have to multiply 100 to 50...i don't think
it will work..

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread kartik sachan
hey anika here n=1 and n=0 so its 1 only

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread kartik sachan
sir i think the same ans i gave the above..

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj NKTM

2011-06-16 Thread kartik sachan
without priority queue its .08 and with priority queue its .0.00

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FIBONACCI problem.

2011-06-16 Thread kartik sachan
ACTUALLY FIBBONACCI SERIERS REAPEAT AFTER 60 TERM SO 246%60 WILLBE 6 SO WE
ONLY HAVE TO FIND M+6 TERM

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FIBONACCI problem.

2011-06-16 Thread kartik sachan
@vipul what algo u have applied for o(1)??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FIBONACCI problem.

2011-06-16 Thread kartik sachan
most simple with bash..using formula 11*f(n+6)+11*f(n+6)%10

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: is it correct??

2011-06-15 Thread kartik sachan
hey is itoa() is supported by g++ compliers???

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: spoj NKTM

2011-06-15 Thread kartik sachan
ya dude finally i applied that algo only

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: is it correct??

2011-06-14 Thread kartik sachan
it is correct ...in c++ 4.3.2 compiler

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] spoj NKTM

2011-06-14 Thread kartik sachan
https://www.spoj.pl/problems/NTKM/

my code is :

# includeiostream
# includecstdio
# includealgorithm
using namespace std;
int main()
{
long long int n;
while(1)
{
long long int a[1]={0},i;
if(scanf(%lld,n)==EOF)
break;
for(i=0;in;i++)
scanf(%lld,a[i]);
sort(a,a+n);
long long int sum=0,sum1=0;
sum=a[0]+a[1];
sum1=sum;
for(i=2;in;i++)
{
sum=sum+a[i];
sum1+=sum;
}
printf(%lld\n,sum1);
}
return 0;
}



plzz tell me test cases where my code fails as i am getting 0


plzz help me out and tell me error...

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: spoj NKTM

2011-06-14 Thread kartik sachan
got AC silliy mistake i am sorting array only one time..

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: spoj NKTM

2011-06-14 Thread kartik sachan
case like
5
1 2 3 45
got worng ans

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] find error

2011-06-13 Thread kartik sachan
amit it is working fine in gcc complier and giving out too i.e
10

what's error in it??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-12 Thread kartik sachan
hey dude nominate me as a group moderator kartik.sac...@gmail.com

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-12 Thread kartik sachan
@shady sorry dude.i am nominating pramendra prathi...@gmail.com

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread kartik sachan
what  dignity u are going to maintain.apne desh k liye kuch to
karo mere dost.apne desh ki dignity nhi bache gi to is group ki
bacha k kya karo ge??and by the i didn't put any thing wrong
in the group.many educated indian are there in the group i just
convey them the message..u got my point

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SPOJ THRBL

2011-06-10 Thread kartik sachan
http://www.spoj.pl/problems/THRBL/

my code is
i am getting TLE

# includeiostream
# includecstdio
using namespace std;
//int search(long long int [],long long )
int main()
{
while(1)
{
int n,m;
int count=0;
long long int a[50010]={0};
int b[50010],c[50010];
if((scanf(%d%d,n,m))==EOF)
break;

int i;
for(i=0;in;i++)
cina[i];
for(i=0;im;i++)
cinb[i]c[i];
int j;
int flag=0;
for(i=0;im;i++)
{

for(j=(b[i]-1);j(c[i]-1);j++)
if(a[(b[i]-1)]a[j])
{
flag=1;
break;
}
if(flag==0)
count++;
flag=0;
}
coutcountendl;
}
return 0;
}

why i am getting TLE...can anyone explain
this...plzz

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] SPOJ THRBL

2011-06-10 Thread kartik sachan
what i understand from the problem was that.
n no of higests are given
and a and b and city no i.e from city a a ball is thrown to city no b
so i have done

from array a[] i.e hieght { n...no of times}
find all the element between b[i].city A and
c[i]city B
then check IF value of b[i] is greater than all the element occur between
them if yes then count++
else count remain same



if any thing worng plzz expain

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] SPOJ THRBL

2011-06-10 Thread kartik sachan
how should we get TLE loop total running less than 10^6??

-- 
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 more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



  1   2   >