[algogeeks] what is complexity of func(p)

2011-08-08 Thread rohit
int get_power(int a, int b) { if(!b) return 1; if(b%2) return a * get_power(a, b/2); return get_power(a, b/2); } int func(int p) { int sum = 0; for(int i = 1; i <= p; ++i) { sum += get_power(i, 5); } return sum; } -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Javascript

2011-08-08 Thread rohit jangid
eks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- You received this message because you are subscribe

[algogeeks] amazon test question!!!

2011-08-08 Thread rohit
What will the following code snippet do, when is it passed the root of a binary tree ? func( Node *node){ if(node->right != NULL) func( node->right); if(node->left != NULL) func( node->left); if( node->left == NULL && node->right == NULL ) delete(node); } Pick choi

[algogeeks] Re: n-ary tree

2011-08-06 Thread rohit
use a linked list to store child nodes, a tree node will hold pointer to next sibling and a pointer to its first child. typedef struct TreeNode{ struct TreeNode * nextSibling; struct TreeNode * fistChild; //rest things } On Aug 6, 4:10 pm, Aman Goyal wrote: > Can anyone suggests a good data struc

Re: [algogeeks] Question

2011-08-05 Thread Rohit Srivastava
Turbo C++ > > > On Fri, Aug 5, 2011 at 7:34 PM, Rohit Srivastava > wrote: > >> you might get error: floating pointing formats not linked!! >> but thats obsolete! I don't compiler these days will give such an error >> otherwise code written by Dipankar will solve u

Re: [algogeeks] Question

2011-08-05 Thread Rohit Srivastava
which compiler are u using ? On Fri, Aug 5, 2011 at 7:29 PM, Vijay Khandar wrote: > I include this fn linkfloat(), Now my program working properlybut > why we have to include this fn externally plz explain. > > > On Fri, Aug 5, 2011 at 6:07 PM, SANDEEP CHUGH wrote: > >> INCLUD

Re: [algogeeks] Question

2011-08-05 Thread Rohit Srivastava
you might get error: floating pointing formats not linked!! but thats obsolete! I don't compiler these days will give such an error otherwise code written by Dipankar will solve ur problem if u r unable to take multi-word input On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro wrote: > try doing thi

Re: [algogeeks]

2011-08-04 Thread Rohit jalan
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. > -- Regards : ROHIT JALAN B.E. Gr

Re: [algogeeks]

2011-08-04 Thread Rohit jalan
groups.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. > -- Regards : ROHIT JALAN B.E. Graduate, Computer Science Department, RVCE, Bangalore --

Re: [algogeeks] merging of two sorted arrays

2011-08-04 Thread Rohit jalan
; For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards : ROHIT JALAN B.E. Graduate, Computer Science Department, RVCE, Bangalore -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. T

Re: [algogeeks] Structure

2011-08-01 Thread Rohit jalan
gt; 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. > > -- Regards : ROHIT JALAN B.E. Graduate, Computer Science Department, RVCE, Bangalore -- You recei

Re: [algogeeks] Google Interview Question

2011-08-01 Thread Rohit jalan
legroups.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. > -- Regards : ROHIT JALAN B.E. Graduate, Computer Science Department, RVCE, Bangalore -

Re: [algogeeks] Re: Amazon

2011-07-30 Thread Rohit jalan
d 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.

[algogeeks] SDET- Amazon

2011-07-29 Thread Rohit jalan
Hi All, Anyone having an idea about the Amazon interview questions for the position SDET(Software Development Engineer in Test) ?? -- Regards : ROHIT JALAN -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group,

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-29 Thread Rohit Srivastava
padding based on the bit interleaving(low order) which is basically hardware dependent. On Fri, Jul 29, 2011 at 10:10 PM, Puneet Gautam wrote: > Thanks guys...so much...!! > > On 7/29/11, nullpointer wrote: > > #include > > #include > > struc MyStructA { > > > > char a; > > char b; > > int c;

Re: [algogeeks] Re: C output

2011-07-28 Thread Rohit Srivastava
no error in dev c++. On Thu, Jul 28, 2011 at 2:43 PM, Piyush Kapoor wrote: > It is not showing compiler error on Codeblocks on my machine. > > > On Thu, Jul 28, 2011 at 2:26 PM, prabhat wrote: > >> i think there will be warning due to inner structure is not declaring >> variable. >> Inn

Re: [algogeeks] Question

2011-07-25 Thread Rohit jalan
groups.google.com/group/algogeeks?hl=en. >> > > -- > 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

Re: [algogeeks] Re: strings

2011-06-22 Thread Rohit Sindhu
gogeeks@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. >>> >> >> -- >> You r

[algogeeks] google interview c testing

2011-06-17 Thread rohit
how to free memory allocated to an array with new function? -- 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...@

Re: [algogeeks] String Swapping Problem

2011-06-16 Thread Rohit Sindhu
ou 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:/

Re: [algogeeks] String Swapping Problem

2011-06-16 Thread Rohit Sindhu
t; 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. > Regards -- Rohit Si

Re: [algogeeks] [brain teaser 15 june ] Engineer Physicist Mathematician puzzle

2011-06-15 Thread Rohit Sindhu
s 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. >>> >&g

[algogeeks] Re: [brain teaser ] Find next number in series 10 june

2011-06-12 Thread rohit
@nicks 42 47... all the terms are either divisible by 7 or contain 7 On Jun 10, 3:29 pm, nicks wrote: > @ankur..how did you get that...explain..plz > > On Fri, Jun 10, 2011 at 3:11 AM, ankur aggarwal > wrote: > > > > > > > > > 42, 49 > > > 2011/6/10 • » νιρυℓ « • > > >> 42, 47 > >> just guessin

[algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-06-12 Thread rohit
ya , you are right On Jun 12, 1:19 pm, hary rathor wrote: > @ rohit : Do you not think that heapchr array is not taking any memory > as question > specification ? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post

[algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-11 Thread rohit
can u pls explain the overflow and underflow in +- approach On Jun 11, 8:58 am, Wladimir Tavares wrote: > Swapping two variables without using a temporary variable using the + and -: > > x = a; > y = b; > > x = x + y / / x = a + b; > y = x - y / / y = a + b-b = a; > x = x - y / / x = a + b-a = b;

[algogeeks] Re: find error

2011-06-11 Thread rohit
it is fine no error.:) On Jun 11, 11:35 pm, amit wrote: > #include > > int main() > { >         struct add >         { >                 int a; >                 int b; >         }x, y; > >         x.a = 10; >         y = x; >         printf("%d", y.a); >         return 0; > > > > > > > > } --

[algogeeks] Re: How to remove duplicate element from array in one pass.

2011-06-11 Thread rohit
is sort the array using merge sort but the only difference is that during merge skip the step where we compare same number and it will take O(nlogn) time correct me if i'm wrong. On Jun 2, 11:19 pm, "D.N.Vishwakarma@IITR " wrote: > better than O(n2) algo > > -- > **With Regards > Deoki Nandan Vis

[algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-06-11 Thread rohit
char *remdup(char *str) { int max_string_length=300; //assume max length is 300 charecters char heapchr[max_string_length]={0}; int input=0; int output=0; char tp; while(*(str+input)!='\0') {tp=*(str+input); if(heapchr[tp]==0) { heapchr[tp]=1; *(str+ouput)=*(str+input); output++; } inpu

Re: [algogeeks] MS interview question

2011-06-09 Thread Rohit Sindhu
uot;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-06-04 Thread Rohit Sindhu
le 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/algoge

Re: [algogeeks] C floating point issue....

2011-06-04 Thread Rohit Sindhu
. > 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. > -- Rohit Sindhu -- You recei

[algogeeks] Re: Array Merge Problem

2011-06-03 Thread rohit
i think solution would be like this eg: A : 1 2 3 B: 0 1.5 4 5 9 Output: A can contain any combination of nos 0,1,1.5 and B should contain 2 3 4 5 9 (in any order.) this example is given by ROSS itself. so sravanreddy solution is right , correct me if i'm wrong. On Jun 3, 8:07 pm, bittu wrote:

Re: [algogeeks] Re:

2011-06-03 Thread Rohit J.
See this note https://www.facebook.com/note.php?note_id=16121578919 On Fri, Jun 3, 2011 at 7:47 PM, ankit sambyal wrote: > Ya mapreduce is a framework. It may use a database. > Facebook uses cloud database, which uses map reduce framework. > > > > On Fri, Jun 3, 2011 at 6:56 AM, Akshata Sharma >

[algogeeks] Re: Reversing a string

2011-06-01 Thread rohit
@saurabh singh one lil addition make your code complete. #include #include int main() { char s[20],t[30],*p,*q; scanf("%s",s); p=s; q=t; while(*(++p)!='\0'); p--; while(p!=s) { *(q++)=*(p--); } *(q++)=*(p--);// first character of str

Re: [algogeeks] Re: LARGEST NUMBER PUZZLE 6 MAY

2011-05-06 Thread Rohit J.
On 5/6/11, Malay Bag wrote: > why not (...((9!^9!)!)!)! or so? there should be some limit on number of > operators Indeed. So, in this case answer will be infinity :). -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group

Re: [algogeeks] Re: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-05-06 Thread Rohit J.
email.rohit.n...@gmail.com Thanks :) Regards Rohit On 5/6/11, naresh kumar wrote: > Pleas mail to me also... > naresh.sac...@gmail.com > Thanks in advance > > On Fri, May 6, 2011 at 1:46 AM, Ashish Modi wrote: > >> Hello, >> Can you please mail me ashishrmo

Re: [algogeeks] Re: LARGEST NUMBER PUZZLE 6 MAY

2011-05-06 Thread Rohit J.
I think (9!^9!)! is the correct answer. 1/0 is not because to be precise it's not defined. Lim(x ->0) 1/x is infinity. :) Cheers Rohit On 5/6/11, subramania jeeva wrote: > (9! pow 9! ) ! :) > > > > > > > > Cheers > ~ Jeeva ~ > > >

[algogeeks] Re: Flipping Coins

2011-04-23 Thread rohit kumra
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor Segment Trees On Apr 23, 7:34 pm, saurabh singh wrote: > I think a lot of discussion has already been made on segment > trees..Check out previous posts. > > On Sat, Apr 23, 2011 at 4:03 PM, KK wrote: > > Hey g

Re: [algogeeks] [brain teaser ] 8april

2011-04-08 Thread rohit agarwal
* ┌─┐ │ Rohit Agarwal │ Undergraduate (Third Year) │ B.Tech (Information Technology) │ NIT Durgapur <http://www.nitdgp.ac.in> │ Blog: http://www.irelaxa.com/rohit └─┘ -- You received this message because you are subscribed

Re: [algogeeks] Re: C puzzle

2011-04-06 Thread rohit agarwal
I fn we are simply changing the address in ptr means ptr will now points to another variable i.e val In fn1 we are changing the value of a variable to which ptr is pointing i.e i so i will be changed. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

[algogeeks] Re: prime number using Sieve of Eratosthenes

2011-03-21 Thread rohit
i just want to know , when we make a program how update array after deleting alternate element. On Mar 21, 4:37 pm, Anurag atri wrote: > what did you not understand in this ? > > On Mon, Mar 21, 2011 at 4:59 PM, rohit wrote: > > genrate prime number using Sieve of Erat

[algogeeks] prime number using Sieve of Eratosthenes

2011-03-21 Thread rohit
genrate prime number using Sieve of Eratosthenes method explanation is here http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes pls 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@goog

Re: [algogeeks] [brain teaser ] 21march

2011-03-21 Thread rohit agarwal
2 minutes -- * Thanks and Regards* ┌─┐ │ Rohit Agarwal │ Undergraduate (Third Year) │ B.Tech (Information Technology) │ NIT Durgapur <http://www.nitdgp.ac.in> │ Blog: http://www.irelaxa.com/rohit └─┘ -- You receive

[algogeeks] Look and say sequence

2011-03-17 Thread rohit
'look and say ' (http://oeis.org/A005150) , begins 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211 , our task is to print this sequence. example: the sequence is: 1, 11 (or one 1), 21 (two 1's), 1211 (one 2, one 1), etc. For the record, each number describes the previous one, using numbers

[algogeeks] Bytes'11 Second Round

2011-02-22 Thread rohit kumra
Don't miss the second session of the coding match. Its gonna be more interesting!! Play the world cup here with your codes. https://www.spoj.pl/BYTES11B/problems/main/ -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, se

[algogeeks] Bytes'11

2011-02-19 Thread rohit kumra
Play the world cup with your codes here. https://www.spoj.pl/BYTES11A/problems/main/ -- 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

Re: [algogeeks] Re: Frequently one of the Top Question Asked in Amazon

2011-01-30 Thread Rohit Saraf
Isn't it just a coding question? @ ^ : your code is not clean enough for anyone to read. As far as data-structures are concerned... a stack and a queue suffice. There is no algorithmic issue I can see. So, I guess you should solve these problems yourself or some programming forum. For those who

Re: [algogeeks] Divide the array into groups

2011-01-30 Thread Rohit Saraf
@ ^ Why do you try hard not to understand the question or what one meant by the question and instead try hard to find out flaws. I mean ain't that obvious that you need to divide into minimum number of groups? -- Rohit Saraf Third Year Undergra

Re: [algogeeks] Divide the array into groups

2011-01-29 Thread Rohit Saraf
I don't see why you need O(n^2) time for rearranging. It can be done in O(n log n) if you maintain the index along with every element. Then reordering would mean sort as per the indices. -- Rohit Saraf Third Year Undergraduate, Dept. of Com

Re: [algogeeks] Sparse Matrix multiplication

2011-01-27 Thread Rohit Saraf
http://www.eecs.harvard.edu/~ellard/Q-97/HTML/root/node20.html -- 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.

Re: [algogeeks] and or tree

2011-01-27 Thread Rohit Saraf
Of course memoization is needed (Can be done by using an array and the fact that it is complete binary tree.) Also if the later half of the array is all 0, then 1 cannot be obtained at the root and vice versa. -- You received this message because you are subscribed to the Google Groups "Algorit

Re: [algogeeks] and or tree

2011-01-27 Thread Rohit Saraf
Let No of flips reqd = solve(N, V) L=left subtree. R = right subtree N = root node. If V=0, then only problem is when L = 1 and R=1. (otherwise atmax changing the root node will do) then ans = min(solve(L, 0), solve(R,0)) + (R=AND)?0:1 If V=1 then only problem is when L=0 and R=0 si

Re: [algogeeks] Google Question

2011-01-23 Thread Rohit Saraf
No special approach is needed. In O(log n), you can find the minimum element of the array which makes your circular array -> normal 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@googlegr

Re: [algogeeks] Re: L values and r values

2011-01-23 Thread Rohit Saraf
Perhaps it is not available. -- 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 opti

Re: [algogeeks] find a way

2011-01-23 Thread Rohit Saraf
@Divya : In that case, a greedy solution does not seem to exist. You need to use the traditional DP 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

Re: [algogeeks] find a way

2011-01-22 Thread Rohit Saraf
Fill in fuel as late as you can. i.e. only if you cannot reach the next station otherwise. -- 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 e

Re: [algogeeks] merging 2 search trees

2011-01-22 Thread Rohit Saraf
Join the two as ^^ says and then perform rotations until the height balances. -- 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 algo

Re: [algogeeks] Brain Teaser

2010-11-11 Thread Rohit Singhal
; > -- > 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 &g

Re: [algogeeks] large array initialization

2010-11-01 Thread Rohit Saraf
].Validity <= d[n+1].Validity ) then d[n+1].Value else d[i].Value There is a practical issue that Validity may become larger than int etc... however that too can be easily overcome. -- Rohit Saraf Third Year Undergraduate, Dept. of Compu

[algogeeks] Re: 2 elements with sum = x

2010-10-10 Thread Rohit
On Oct 10, 10:48 am, Shravan wrote: > http://ideone.com/D5W2y > Good :). What if array is unsorted. What will be the best solution in terms of time complexity? Better then (nlog(n)+n). Regards Rohit -- You received this message because you are subscribed to the Google Groups &quo

Re: [algogeeks] search a 2d sorted array in less than O(n)

2010-09-28 Thread Rohit Saraf
rejected straightforward from just this info. Hence the complexity T(m,n) = 2 * T(m/4,n/4) + c Rohit Saraf Third Year Undergraduate Compter Science & Engineering IIT Bombay -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. T

Re: [algogeeks] clear screen in mysql

2010-09-14 Thread Rohit Saraf
well i just wanted u to know that there is a very nice place called www.google,com where u can find many things. -- 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 f

Re: [algogeeks] clear screen in mysql

2010-09-13 Thread Rohit Saraf
See it here : jfgi -- 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

Re: [algogeeks] STRONG ACTION GIRL REAL STUNTS SWEET AND SEXY http://businproz.blogspot.com/ http://businproz.blogspot.com/ http://businproz.blogspot.com/

2010-06-20 Thread Rohit Saraf
Someone ban this spammer -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] back edges

2010-06-20 Thread Rohit Saraf
@piyush : what do u mean by " let node j be the 1st node not visited"? or are u foretting the cross edges? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb1

Re: [algogeeks] back edges

2010-06-20 Thread Rohit Saraf
You start from a vertex, then if you reach that vertex before dfs on that vertex finishes, then the edge u used to reach it is a back edge. And if you reach after the dfs finishes on that node, it's a cross edge. -- Rohit Saraf Second

Re: [algogeeks] Integer from number in words

2010-06-20 Thread Rohit Saraf
You need to specify the max level upto which you want it to work. For rest, is there any prob? I can't see any. you see ninety -> 90 u see thousand -> 90*1000 + and so on -- Rohit Saraf Second Year Undergraduate, Dept. of Compu

Re: [algogeeks] minimum spanning tree

2010-06-20 Thread Rohit Saraf
If you have Eva Tardos book, this is an illustration in the book. Since the prove requires diagrams I cannot put it here. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in

Re: [algogeeks] Re: SPOJ:RRSCHED

2010-06-20 Thread Rohit Saraf
No -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 20, 2010 at 3:22 PM, Shravan wrote: > Did you see the code which I have posted. > On Jun 20

Re: [algogeeks] finding nearest neighbour

2010-06-20 Thread Rohit Saraf
It was my lab assignment prob last year. Will send u if i happen to find it by chance. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Mon, Jun 14, 2010 at 10

Re: [algogeeks] Re: SPOJ:RRSCHED

2010-06-20 Thread Rohit Saraf
You must be doing some useless iterations . Otherwise, TLE is too strange for this prob. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sat, Jun 19, 2010 at 9

Re: [algogeeks] There is an array of odd and even numbers. Now, sort them in such a way that the top portion of the array contains odd numbers, bottom portion contains even numbers

2010-06-20 Thread Rohit Saraf
Why not just change the definition of when one number is bigger than another and do normal sort ? I guess that is better and simpler. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http

Re: [algogeeks] ACTIVATION OF WINDOWS 7

2010-06-20 Thread Rohit Saraf
So, is this the place for that? And apart from that, it is illegal to discuss about this on public threads. (if you don't know, this thread is public) -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT B

Re: [algogeeks] palindrome substring

2010-06-18 Thread Rohit Saraf
abcqwertycba So is abc a palindrome?? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Fri, Jun 18, 2010 at 3:08 PM, Chunyuan Ge wrote: > Origin strin

Re: [algogeeks] Re: coins

2010-06-17 Thread Rohit Saraf
Yes right, i forgot the "1" -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Thu, Jun 17, 2010 at 6:05 PM, Dave wrote: > No. The greedy algorithm

Re: [algogeeks] Re: coins

2010-06-16 Thread Rohit Saraf
@Dave: The greedy will only work if the coins are k,2k,3k,4k, nk without any of these missing Clear? (Perhaps i did not write it clearly as i was on mobile) -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and

Re: [algogeeks] coins

2010-06-16 Thread Rohit Saraf
If the coins are all multiple of some number k, you can greedily give as much as possible to the higher domination. Otherwise still, there is an optimal substructure and u can make a recurrence and use memoization(i.e. DP) -- -- Rohit Saraf Second

Re: [algogeeks] unique number in an array

2010-06-15 Thread Rohit Saraf
Just to point out : how many times have you all repeated this -- "Xor works only -- even number of times. It will not work..." Why don't you all read some earlier posts before posting. :P -- Rohit Sa

Re: [algogeeks] Re: Cycle in Undirected and Directed Graphs

2010-06-15 Thread Rohit Saraf
@vivek : was that a joke? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Mon, Jun 14, 2010 at 11:40 AM, souravsain wrote: > @sharad: Do you have some arti

Re: [algogeeks] trees

2010-06-13 Thread Rohit Saraf
Repeated q. Search in the group -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Cycle in Undirected and Directed Graphs

2010-06-13 Thread Rohit Saraf
In any directed graph just check if dfs has a back edge. For undirected, check if there is a nontree edge -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14

Re: [algogeeks] Re: bits

2010-06-13 Thread Rohit Saraf
I agree mass bombarding with such questions is not very good.. but one doesn't join groups and all for getting a few doubts cleared. Anyways, i have no problem with anything. :D -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Scienc

Re: [algogeeks] Re: bits

2010-06-13 Thread Rohit Saraf
@Souravsain : Is there any serious problem in this. Anyone can just add a [C++] in the subject and uninterested people can make filters in gmail :) -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http

Re: [algogeeks] union- c

2010-06-13 Thread Rohit Saraf
If you are not able to print the long int and that's the prob, you can use %ld instead of %d -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 13,

Re: [algogeeks] c- pointers

2010-06-13 Thread Rohit Saraf
@jalaj: exactly... so you(@divya) are right. Sharad's ans was right but logic wasn't. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 13, 20

Re: [algogeeks] c array

2010-06-13 Thread Rohit Saraf
; the best compiler today. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 13, 2010 at 1:47 PM, divya jain wrote: > i use tc > > > On

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread Rohit Saraf
Put the function speed or its declaration inside the class b. Did u forget that? -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread Rohit Saraf
yes.. it should... make sure your virtual function is either public or protected but not private. and if it doesn't can u tell me the error? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread Rohit Saraf
Make those functions public And even if M_speed is public of another class, it is still it another class, you cannot just address it like m_speed in other classes. Does it help? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and

Re: [algogeeks] Problem with Virtual Function

2010-06-12 Thread Rohit Saraf
M-speed is private and you cannot call it from outside myPlugin. (though i did not understand what u wanted to say) Can you write ur prob explicitly? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http

Re: [algogeeks] union- c

2010-06-12 Thread Rohit Saraf
what is this for... and which conversion are you talking abt? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sat, Jun 12, 2010 at 11:20 PM, divya wrote

Re: [algogeeks] c array

2010-06-12 Thread Rohit Saraf
which compiler do you use? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 13, 2010 at 10:46 AM, divya jain wrote: > hmm..the prob is here wid

Re: [algogeeks] c- pointers

2010-06-12 Thread Rohit Saraf
@divya: u r rite.. that * should not be there -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 13, 2010 at 11:07 AM, divya jain wrote: > ptr i

Re: [algogeeks] output

2010-06-12 Thread Rohit Saraf
I read that. But still it should not be compiled as per the standard. The latest GNU C/C++ compiler correctly fails to compile this -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http

Re: [algogeeks] c array

2010-06-12 Thread Rohit Saraf
oh.. yes.. my mistake (strings\0).length=8 :P -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Sun, Jun 13, 2010 at 10:24 AM, Rahul Kushwaha wrote: > #incl

Re: [algogeeks] Re: Array Problem

2010-06-12 Thread Rohit Saraf
@Satya: I don't think what you have coded will work.. though i have not read the whole code. Don't you think a simple divide and conquer scheme would work...(almost like the mergesort) -- Rohit Saraf Second Year Undergraduate, Dept. o

Re: [algogeeks] output

2010-06-12 Thread Rohit Saraf
This is very bad. Change your compiler if it compiles this stuff :) btw.. which compiler is it? Output for me : ro...@rohit-laptop:~/dump$ gcc c.c c.c: In function ‘main’: c.c:14: error: incompatible types when assigning to type ‘char[20]’ from type ‘char *’ c.c:15: error: incompatible types

Re: [algogeeks] c array

2010-06-12 Thread Rohit Saraf
@ram : i guess you have used some longer string and not "strings" btw.. what is Mingw ? gcc/g++ is not mingw, i guess -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.

Re: [algogeeks] sum to x

2010-06-11 Thread Rohit Saraf
I guess it can be done in efficiently using a simple divide and conquer scheme almost imitating mergesort. Can you think of it now? :D -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http

Re: [algogeeks] Print large Fibonacci numbers

2010-06-11 Thread Rohit Saraf
Fibonacci numbers can be calculated very efficiently using matrix multiplications. I hope you can think it/google it now.. that is better than me writing so much again :) -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and

<    1   2   3   4   >