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
shuldn't it be f(246+m)%10 last one
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.com wrote:
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
main(){scanf(%d,t);while(t--)scanf(%d,m)printf(%d\n,f(m+11)-f(m+1)+f(6+m)%10));}
My best attempt with the c code..132 bytes still
Now
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
got it repetition in cycles of 60
On Thu, Jun 16, 2011 at 12:35 PM, vaibhav agarwal
vibhu.bitspil...@gmail.com wrote:
shuldn't it be f(246+m)%10 last one
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.comwrote:
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
n^2
On Thu, Jun 16, 2011 at 12:41 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Number Trick Riddle - 16 june * *
* * ***
**
*Sonal asked the class to see if they could find the sum of the first 50
odd numbers. As everyone settled down to their addition, Lavesh ran to her
and said, 'The
Nice Solution!
--
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/-/PGCJcmtuYqEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
//kk
//In place of
char *p=hai friends,*p1;
if i declare as
char p[]=hai friends;
char *p1;
//then ??
On Thu, Jun 16, 2011 at 8:16 AM, DIPANKAR DUTTA
dutta.dipanka...@gmail.comwrote:
It's ok..
char *p=hai friends...not correct
bcz you did allocate memory for that string but assiging
The place where strict constness is not enforced is with character
array literals. You can say
char* cp = howdy;
and the compiler will accept it without complaint. This is
technically an error because a character array literal (“howdy” in
this case) is created by the compiler as a constant
www.spoj.pl/problems/BLINNET/
Here is the code for the same... Its not getting AC in SPOJ
m not able to figure out wheres the hole in this... plzz help
#includeiostream
#includestring
#includevector
#includelist
#includequeue
#define MAXINT (int)9e9
#define TR(a,it)
++*p++
==
++(*p++) ,
increments the value stored at p , and also increments p .
On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal sunny816.i...@gmail.comwrote:
The place where strict constness is not enforced is with character
array literals. You can say
char* cp = howdy;
and the compiler
without DP it will be TLE..
-
PRAMENDRA RATHI
NIT ALLAHABAD
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.com wrote:
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
My AC solution is O(1).
On Thu, Jun 16, 2011 at 2:29 PM, PRAMENDRA RATHi rathi
prathi...@gmail.comwrote:
without DP it will be TLE..
-
PRAMENDRA RATHI
NIT ALLAHABAD
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.comwrote:
lalit u r wrong
On Thu, Jun 16, 2011 at 1:44 PM, LALIT SHARMA lks.ru...@gmail.com wrote:
++*p++
==
++(*p++) ,
increments the value stored at p , and also increments p .
On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal sunny816.i...@gmail.comwrote:
The place where strict constness is not
Well dont know...My pure recursive solution in python got AC in 0.07s(93
bytes).No DP involved.And I don't think python is faster than c?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Very sorry i did used memoization..Ya not possible with o(2^n)
solution...Apologies once again
On Thu, Jun 16, 2011 at 3:21 PM, saurabh singh saurab...@gmail.com wrote:
Well dont know...My pure recursive solution in python got AC in 0.07s(93
bytes).No DP involved.And I don't think python
hint : think it as matrix raised to some power ( then u can compute that in
log(n) ) or other way around is to find cycle length . :-)
On Thu, Jun 16, 2011 at 3:56 PM, saurabh singh saurab...@gmail.com wrote:
Very sorry i did used memoization..Ya not possible with o(2^n)
@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.
Binet's Formula.
( keep shortening :P )
On Thu, Jun 16, 2011 at 5:57 PM, kartik sachan kartik.sac...@gmail.comwrote:
@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
n^2.
Easy One!
--
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/-/ztyVPtQgX64J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
simple with AWK
-
PRAMENDRA RATHI
NIT ALLAHABAD
2011/6/16 • » νιρυℓ « • vipulmehta.1...@gmail.com
Binet's Formula.
( keep shortening :P )
On Thu, Jun 16, 2011 at 5:57 PM, kartik sachan kartik.sac...@gmail.comwrote:
@vipul what algo u have applied
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
I have read this link,still i am not getting.Can anybody help??
On 6/16/11, Kamakshii Aggarwal kamakshi...@gmail.com wrote:
I have read this link,still my not getting.Can anybody help??
On 6/15/11, Maksym Melnychok keym...@gmail.com wrote:
that's floating point for you.
i still din't get the solution..please explain..
On 6/16/11, LALIT SHARMA lks.ru...@gmail.com wrote:
++*p++
==
++(*p++) ,
increments the value stored at p , and also increments p .
On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal
sunny816.i...@gmail.comwrote:
The place where strict
I have read this link,still my not getting.Can anybody help??
On 6/15/11, Maksym Melnychok keym...@gmail.com wrote:
that's floating point for you.
http://en.wikipedia.org/wiki/Floating_point
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
BK tree would be a good DS for this.
-Sri
On Wed, Jun 15, 2011 at 6:00 PM, keyan karthi keyankarthi1...@gmail.com wrote:
we can even add word completion :)
On Wed, Jun 15, 2011 at 5:25 PM, immanuel kingston
kingston.imman...@gmail.com wrote:
Use a trie data structure and pre-load it with
hi friends is a string literal.. ie the string hi friends is stored
somewhere and a pointer to its base address is returned to pointer p at the
time of initialization... u can always make use of this pointer to traverse
/ access the literal but u cant alter tat in the code, u r trying to do
a ++
@Sunny, it is good that you follow Bruce Eckel, but copy pasting the exact
thing? :)
On Thu, Jun 16, 2011 at 7:34 PM, keyan karthi keyankarthi1...@gmail.comwrote:
hi friends is a string literal.. ie the string hi friends is stored
somewhere and a pointer to its base address is returned to
yes copy pasting the exact thing :)
for better understanding :)
On Thu, Jun 16, 2011 at 8:06 PM, Navneet Gupta navneetn...@gmail.comwrote:
@Sunny, it is good that you follow Bruce Eckel, but copy pasting the exact
thing? :)
On Thu, Jun 16, 2011 at 7:34 PM, keyan karthi
Then i would suggest you give the original reference in such cases for still
better understanding :)
Be it a book or a website.
On Thu, Jun 16, 2011 at 8:13 PM, sunny agrawal sunny816.i...@gmail.comwrote:
yes copy pasting the exact thing :)
for better understanding :)
On Thu, Jun 16, 2011 at
#define f(g,g2) g##g2
main()
{
int var12=100;
printf(%d,f(var,12));
}
output-100
--
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
@sunny thanks, that post did clear the confusion.
On Thu, Jun 16, 2011 at 8:17 PM, Navneet Gupta navneetn...@gmail.comwrote:
Then i would suggest you give the original reference in such cases for
still better understanding :)
Be it a book or a website.
On Thu, Jun 16, 2011 at 8:13 PM,
g##g2 means gg2 i,e concat g g2 by the property of #define it is
replace where it is called.
On Thu, Jun 16, 2011 at 8:36 PM, amit the cool amitthecoo...@gmail.comwrote:
#define f(g,g2) g##g2
main()
{
int var12=100;
printf(%d,f(var,12));
}
output-100
--
You received this message
@Arpit
Thanks to Bruce Eckel :D
On Thu, Jun 16, 2011 at 9:00 PM, Arpit Sood soodfi...@gmail.com wrote:
@sunny thanks, that post did clear the confusion.
On Thu, Jun 16, 2011 at 8:17 PM, Navneet Gupta navneetn...@gmail.comwrote:
Then i would suggest you give the original reference in such
#includestdio.hvoid swap(char *,char *);int main(){char *ps[2]={
Hello,
Good Mornning,
};swap(ps[0],ps[1]);printf(%s \t %s\n,ps[0],ps[1]);return 0;}
void swap(char *p,char *q){char *t;t=p;p=q;q=t;}
why the output is:
HelloGood Mornning
--
instead of calling swap(ps[0],ps[1]) can u try with swap(ps[0],ps[1]) or
swap(ps[0][0],ps[1][0]) ?
On Fri, Jun 17, 2011 at 5:05 AM, udit sharma sharmaudit...@gmail.comwrote:
#includestdio.hvoid swap(char *,char *);int main(){char *ps[2]={
Hello,
Good Mornning,
Ohh Sry... The qus was:
#includestdio.hvoid swap(char *,char *);int main(){char *ps[2]={
Hello,
Good Mornning,
};swap(ps[0],ps[1]);printf(%s \t %s\n,ps[0],ps[1]);return 0;}
void swap(char *p,char *q){char *t;t=p;p=q;q=t;}
why the output is:
Hello
The function swap just swaps it's local copy of pointers which does not mean
that it swap array elements. You have to do it explicitly.
On Fri, Jun 17, 2011 at 3:17 AM, udit sharma sharmaudit...@gmail.comwrote:
Ohh Sry... The qus was:
#includestdio.hvoid swap(char *,char *);int
Please suggest me some good online tutrial on operating system ?
Thanks in advance
--
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
#includestdio.h
void swap(char **p,char **q)
{
char *t;
t=*p;
*p=*q;
*q=t;
}
int main(){
char *ps[2]={
Hello,
Good Morning,
};
swap( ps[0] , ps[1]);
printf(%s \t %s\n,ps[0],ps[1]);
return 0;
}
This one breaks the ice ... as you have to change the contents of the array
If interested, shoot me an email at rodrigo.stockebr...@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
Which algorithm would I use if I had an e-commerce website that
captured user data (shopping data, site navigation data, and social
media data) and I wanted to come up with a formula that would tell me
which products sell best (when they sell best, to whom they sell best,
etc...)?
Any ideas would
This is depending on the precission of floating point number representation
(IEEE double pression or single precission ) and how it is handled by the
compilers)
On Thu, Jun 16, 2011 at 8:50 PM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
I have read this link,still i am not getting.Can
Question:
main()
{
char str[] = hai friends;
char *p,*p1;
p = str;
p1=p;
while(*p != 's')
{
++*p++;
}
printf( %s,p1);
}
http://codepad.org/24hmvzP5
Ans: ibj!gsjfoes
On Thu, Jun 16, 2011 at 9:24 AM, sunny agrawal sunny816.i...@gmail.comwrote:
@Arpit
Thanks to Bruce
I think this can be performed by forming an augumented data strcture (like
augmented linked list or BST).. then you can apply the genraral algorithm
like sorting searching or graph algo...
to performance imporovement you can use cache or has table...
On Fri, Jun 17, 2011 at 7:27 AM, Rigo
(this is dependon on compiler implementaion)this is due to shortcircuit
implementaion of intermidiate code genaration phase of compiler..
please read Aho ullman book of compiler desgn to get more details.
On Wed, Jun 15, 2011 at 12:51 AM, snehi jain snehijai...@gmail.com wrote:
first
We can optimize the code using DP...
On Wed, Jun 15, 2011 at 8:24 PM, immanuel kingston
kingston.imman...@gmail.com wrote:
The following is for LCA for 2 nodes in a n-ary tree.
A more tougher problem is to find the LCA for n nodes in the same n-ary
tree.
Node * findLCA (Node *root, Node *
@amit ,
Then explain me , in simpler words .. as i am not able to get it ...
On 6/17/11, Anand anandut2...@gmail.com wrote:
Question:
main()
{
char str[] = hai friends;
char *p,*p1;
p = str;
p1=p;
while(*p != 's')
{
++*p++;
}
printf( %s,p1);
}
47 matches
Mail list logo