Re: [algogeeks] Re: c program

2011-08-27 Thread Piyush Grover
char*f="char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c"; f is a global pointer to the char array which contains the string "char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c" Now in main function you are printing this string with arguments 34,f,34,10. ASCII value of " is 34. ->So in f, the first %c is

[algogeeks] How to save a binary search tree space efficiently

2011-08-27 Thread rohit
How to save a binary search tree space efficiently and built it again , just tell any idea. -- 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

Re: [algogeeks] Re: Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-27 Thread muthu raj
@Dave: Explain your O(n3) solution please *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sat, Aug 27, 2011 at 11:10 PM, Mohit Goel wrote: > This code may also work .give any counter examples... > > > #include > using namespace std; > void find_sum(int num,int k,int j,int b); > void di

[algogeeks] Re: c program

2011-08-27 Thread rahul sharma
i m not able to understand hw it wokrs..elaborate it On Aug 28, 11:16 am, rahul sharma wrote: > plz expalin char*f="            " > > On Aug 28, 11:12 am, Piyush Grover wrote: > > > > > > > > > it's a quine problem. > > > char*f="char*f=%c%s%c; > > main(){ > > printf(f,34,f,34,10);}%c"; > >

[algogeeks] Re: c program

2011-08-27 Thread rahul sharma
plz expalin char*f="" On Aug 28, 11:12 am, Piyush Grover wrote: > it's a quine problem. > > char*f="char*f=%c%s%c; > main(){ > printf(f,34,f,34,10);}%c"; > > main() > { > printf(f,34,f,34,10); > > } > > I have used whitespaces to make it understand. > > On Sun, Aug 28, 2011 at 11:39

Re: [algogeeks] Re: bits

2011-08-27 Thread Dheeraj Sharma
class A { public: A() { static int cou; cout<<++cou< wrote: > already discussed, search the forum > > On Aug 28, 10:53 am, guna sekaran wrote: > > print 1 to 10 without using > > if,loops,goto, function call.recursion,etc > > -- >

Re: [algogeeks] c program

2011-08-27 Thread Piyush Grover
it's a quine problem. char*f="char*f=%c%s%c; main(){ printf(f,34,f,34,10); }%c"; main() { printf(f,34,f,34,10); } I have used whitespaces to make it understand. On Sun, Aug 28, 2011 at 11:39 AM, rahul sharma wrote: > program whose output is the program itself??? > > -- > You receive

Re: [algogeeks] Re: Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-27 Thread Mohit Goel
This code may also work .give any counter examples... #include using namespace std; void find_sum(int num,int k,int j,int b); void display(int i,int j); #define MAX 8 int res[4]; //array to store 4 numbers.. int arr[MAX] ={2,3,4,1,6,9,8,10}; in

[algogeeks] c program

2011-08-27 Thread rahul sharma
program whose output is the program itself??? -- 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...@go

[algogeeks] Re: bits

2011-08-27 Thread shady
already discussed, search the forum On Aug 28, 10:53 am, guna sekaran wrote: > print 1 to 10 without using > if,loops,goto, function call.recursion,etc -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to alg

[algogeeks] Re: Problem on overflow

2011-08-27 Thread Dave
@Avinash: maxint is the largest possible integer. There aren't any integers greater than it. Thus, a can't be greater than maxint. For example, if an int is 32 bits, maxint = 2^31 - 1. Dave On Aug 27, 10:41 pm, "Avinash LetsUncomplicate.." wrote: > @dave i was saying if user enter a+b in which a

Re: [algogeeks] c program explain

2011-08-27 Thread Sanjay Rajpal
It is checking the MSB of the integer and, it is 1(checked by Bitwise AND with 1 at MSB), it prints 1 else 0. Sanju :) On Sat, Aug 27, 2011 at 9:25 PM, rohit wrote: > how is this program convert number to binary equivalent > int main() > { > unsigned int num =23 ; > int i; > for(i=0;i<16;i+

[algogeeks] c program explain

2011-08-27 Thread rohit
how is this program convert number to binary equivalent int main() { unsigned int num =23 ; int i; for(i=0;i<16;i++) printf("%d\n",(num

Re: [algogeeks] Re: Winshuttle Pattern and Question *Urgent*

2011-08-27 Thread Dipankar Patro
First round written - Two parts : 20 C-questions, + 5 Apti Time 25 minutes. C-questions - all copied from Test Your C-Skills. (literally). Just mug up all questions from Test Your C-Skills. Second coding round. Simple algo based, written (15 minutes) Interview rounds after that. On Sun, Aug 28,

Re: [algogeeks] Re: microsoft

2011-08-27 Thread Dipankar Patro
Just go through Test Your C-Skills properly for first section: Here are some questions that I faced: Section 1 problems. Total time 30 minutes: 1. x = x^x; printf("%d", x); o/p? 2. some automation-graph question. I think it was based on Automata. Not sure though. 3. z = scanf("%d %d", &x, &y);

Re: [algogeeks] Re: prog

2011-08-27 Thread Dipankar Patro
DBMS is Data-Base Management System. It is the concept of managing data so that retrieval, modification, etc operations can be carried out efficiently. It has different models for implementation. RDMS (Relational DBMS) is a model of DBMS that uses tables to manage data. Other models also exist, e

Re: [algogeeks] Problem on overflow

2011-08-27 Thread Avinash LetsUncomplicate..
@dave i was saying if user enter a+b in which a>intmax .. A goes negative(if a sligtly >intmax) a+b =no overflow which we know shouldnt be an answer.. On 8/28/11, Dave wrote: > @Kunal: You are very kind. > > Dave > > On Aug 27, 12:58 pm, Kunal Patil wrote: >> @Dave: Still your approach to solve

Re: [algogeeks] Re: Winshuttle Pattern and Question *Urgent*

2011-08-27 Thread Algorithm Geek
Winshuttle Procedure : First Round : C Aptitude, Quantitative Aptitude 30 Mins Test 2nd : Coding Round 3rd : Technical Interview 4th : Technical + HR Hope it helps :) On Sat, Aug 27, 2011 at 11:38 AM, Brijesh wrote: > lol.. Tu bhi yahin pe? > yaar samsung me intern he mili hai.. final offe

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-27 Thread saurabh singh
main() { int a=4,b=6; printf("\n%d\n",printf("%*s%*s",a,"",b,"")); } -- Saurabh Singh B.Tech (Computer Science) MNNIT 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.

[algogeeks] Re: 2 Binary trees are isomorphic?

2011-08-27 Thread Dave
@Bugaboo: Use recursion. Assuming struct tree_node { tree_node *left; tree_node *right; int data; }; int AreIsomorphic(tree_node tree1, tree_node tree2) { if( tree1 == NULL && tree2 == NULL ) return TRUE; // both trees are null if( tree1 == NULL || tree2 == NULL)

Re: [algogeeks] 2 Binary trees are isomorphic?

2011-08-27 Thread bugaboo
I guess this should work: The logic is pretty evident from the pseudo-code. boolean IsIsomorphic(Node x, Node y) { return IsIsomorphic(x.left, y.left) AND IsIsomorphic(x.right, y.right) if (x == null && y == null) return true // both null if (x == null || y == null) return false //

Re: [algogeeks] 2 Binary trees are isomorphic?

2011-08-27 Thread bugaboo
XOR'ing will not work since 2 binary trees do not necessarily have to have the same values. As long as the "structure" is the same, then the trees are considered as isomorphic. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this di

[algogeeks] Re: SAP!!

2011-08-27 Thread prasanna
hi SAP coming to my college too. someone pls enlighten abt the selection procedure. On Aug 21, 8:26 pm, rashmi i wrote: > Hey, SAP is visiting our college. Any idea about the pattern of the campus > selection  process? As in type of questions asked? Thanks > -- > R@$!-! > "DoN'T LimIt Ur cHaLlEng

Re: [algogeeks] Dead code removal for c program

2011-08-27 Thread rajeev bharshetty
Usually compilers do the job of dead code elimination during optimizations. Gcc does that during compilation. On Sun, Aug 28, 2011 at 1:34 AM, rajeev bharshetty wrote: > You can go through this link > http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html > > > On Sat, Aug 27, 2011 at 6:49 PM,

Re: [algogeeks] Dead code removal for c program

2011-08-27 Thread rajeev bharshetty
You can go through this link http://gcc.gnu.org/ml/gcc-help/2003-08/msg00128.html On Sat, Aug 27, 2011 at 6:49 PM, john robin wrote: > Hi, > > I've an interesting task. Given a c program say hi.c as input to a > program, the program should be able to return a file hi1.c such that > all dead

[algogeeks] Re: Problem on overflow

2011-08-27 Thread Dave
@Kunal: You are very kind. Dave On Aug 27, 12:58 pm, Kunal Patil wrote: > @Dave: Still your approach to solve the problem remains correct. > (subtracting a number from max possible value & then comparing this > difference with another number). So, no need to think that you were brain > dead (If

[algogeeks] Re: Adding Two no without using any operator...??

2011-08-27 Thread Dave
@Brijesh: Maybe you mean char *p; p = (char*)a; sum = (int)&p[b]; // sum = a + b but & is an operator. Dave On Aug 27, 2:07 pm, Brijesh wrote: > How to add two nos without using any operator...? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" g

[algogeeks] Re: Adding Two no without using any operator...??

2011-08-27 Thread Dave
@Mohit: Do you mean int add(int a, int b) { if (!a) return b; else return add((a & b) << 1, a ^ b); } Carries normally go to the left, not to the right. Dave On Aug 27, 2:28 pm, Mohit kumar lal wrote: > int add(int a, int b) > { >         if (!a)

[algogeeks] Re: Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-27 Thread Dave
@Dheeraj: This is a great solution. My first thought has complexity O(n^3) and uses O(1) extra space. For your algorithm, sorting an array of size n^2 would be O(n^2 log n), so your algorithm has complexity O(n^2 log n) and uses extra space of size O(n^2). We can see the tradeoff of space for compl

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread tech coder
int add(int a,int b) { int sum=a^b; int carry=a&b; while(carry!=0) { carry<<=1; a=sum; b=carry; sum=a^b; carry=a&b; } return sum; } On Sat, Aug 27, 2011 at 12:28 PM, Mohit kumar lal wrote: > int add(int a, int b) > { >

[algogeeks] Re: elitmus test

2011-08-27 Thread prasanna
thanks...:) hope someone adds some more questions..:) -- 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...@google

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Mohit kumar lal
int add(int a, int b) { if (!a) return b; else return add((a & b) >> 1, a ^ b); } On Sun, Aug 28, 2011 at 12:54 AM, sagar pareek wrote: > yeah one option is half adder with "xor" and "and" operators > > one more solution > > http://www.ideone.com/B0

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread sagar pareek
yeah one option is half adder with "xor" and "and" operators one more solution http://www.ideone.com/B07bn On Sun, Aug 28, 2011 at 12:41 AM, Gaurav Menghani wrote: > I guess you mean without using any 'arithmetic operator'. If yes, it > can be done with XOR and AND operators. > > Not sure how

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Gaurav Menghani
I guess you mean without using any 'arithmetic operator'. If yes, it can be done with XOR and AND operators. Not sure how it can be done otherwise, without using any kind of operators AT ALL. On Sun, Aug 28, 2011 at 12:37 AM, Brijesh wrote: > How to add two nos without using any operator...? > >

[algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Brijesh
How to add two nos without using any operator...? -- 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/-/MpNKzlE3UuwJ. To post to this group, send email to algogee

[algogeeks] Re: Winshuttle Pattern and Question *Urgent*

2011-08-27 Thread Brijesh
lol.. Tu bhi yahin pe? yaar samsung me intern he mili hai.. final offer nahi :| and btw winshuttle us se achhi hai shayad! On Aug 27, 4:08 pm, SANDEEP CHUGH wrote: > @birju : Samsung nhi leni kya?? > > On Sat, Aug 27, 2011 at 12:45 PM, Brijesh wrote: > > > > > > > > > Can anyone please post the p

Re: [algogeeks] Re: String passing

2011-08-27 Thread sagar pareek
@raj u already mentioned that if we write :- char *p="hello"; p[0]='k'; // gives runtime error so if we are passing arguments as modify(char a[],char *b) { . . } main() { . . modify("hello","hi"); . . } then its actually char arr[]="hello"; char *b="hi"; so ofcourse now b[0]='a'; // give u

Re: [algogeeks] Tejas networks

2011-08-27 Thread Kamakshii Aggarwal
thanks dheeraj...and yeah u r correct..:) On Sat, Aug 27, 2011 at 11:54 PM, Dheeraj Sharma < dheerajsharma1...@gmail.com> wrote: > its still to come in our college..but u can go through this link..i hope it > wud help u.. > > http://sameerbsws.blogspot.com/2010/12/latest-tejas-networks-placement-

Re: [algogeeks] Tejas networks

2011-08-27 Thread Dheeraj Sharma
its still to come in our college..but u can go through this link..i hope it wud help u.. http://sameerbsws.blogspot.com/2010/12/latest-tejas-networks-placement-papers.html coz i thnk..u r frnd of one of mah close frnd ;) On Sat, Aug 27, 2011 at 11:45 PM, Kamakshii Aggarwal wrote: > can anyone tel

[algogeeks] Tejas networks

2011-08-27 Thread Kamakshii Aggarwal
can anyone tell about tejas networks recruitment procedure? and also what topics are being asked? -- Regards, Kamakshi kamakshi...@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@goog

Re: [algogeeks] Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-27 Thread Dheeraj Sharma
create an array of all possible PAIR sums..that would be done in O(n^2)..sort it..O(log(n))now..search this array for two pairs..that sum to the required value.. this can be done by maintaining two index..one at the lowest value..one at the highest value..and moving them accordingly..(if sum of pai

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread Kunal Patil
@Dave: Still your approach to solve the problem remains correct. (subtracting a number from max possible value & then comparing this difference with another number). So, no need to think that you were brain dead (If you were, you would have posted a movie story here)..[?] Mathematically it is wrong

Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread Gaurav Menghani
Yeah, sorry I was giving a hint for DIVSUM2, which is a much harder version of DIVSUM. You are checking all numbers less than n for divisibility. This is O(n). Figure out how can you find the set of divisors using primes. This can be done in O(2^d), if there are d prime divisors. On Sat, Aug 27

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread dipit grover
Oops, I just saw that Dave had already corrected it. Net problem, sorry guys! On Sat, Aug 27, 2011 at 11:02 PM, dipit grover wrote: > I think you just need to reverse the comparison operators in Dave's earlier > post > > > On Sat, Aug 27, 2011 at 10:59 PM, Dave wrote: > >> @Abishek: I was brain-

Re: [algogeeks] 2 Binary trees are isomorphic?

2011-08-27 Thread Rahul Verma
@raghavan i also think the same. -- 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/-/gV3RWQxu0gEJ. To post to this group, send email to algogeeks@googlegroups.

Re: [algogeeks] Re: SPOJ ACODE

2011-08-27 Thread Piyush Kapoor
There is nothing much particular to java,, Here is the code(simply copy pasted from the above one) in C:: int main(){ char ar[100]; int dp[1000]; scanf("%s",ar); if(ar[l-1]!='0') dp[l-1]=1; for(int j=l-2;j>=0;j--)

Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread Gaurav Menghani
http://lmgtfy.com/?q=pollard%27s+rho+algorithm On Sat, Aug 27, 2011 at 11:05 PM, Rahul Verma wrote: > @gaurav Thanks dear > Could you please explain the algorithm. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this disc

Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread saurabh modi
you could use seiving.its fast.its practical. -- 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.c

Re: [algogeeks] 2 Binary trees are isomorphic?

2011-08-27 Thread Raghavan
It may be done like, - Read one tree and hold the values in a array A. - While reading the other tree start XORing with the values in the array A - If the array A is completely empty in the end then we can assume both the trees are isomorphic. Hope this could be a solution. On S

Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread Rahul Verma
@gaurav Thanks dear Could you please explain the algorithm. -- 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/-/TNa8UygkzGkJ. To post to this group, send e

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread dipit grover
I think you just need to reverse the comparison operators in Dave's earlier post On Sat, Aug 27, 2011 at 10:59 PM, Dave wrote: > @Abishek: I was brain-dead in my earlier posting. Let me try again: > > If either number is zero, the sum will not overflow. > If the numbers have different signs, the

[algogeeks] Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-27 Thread tech coder
Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num. -- 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

[algogeeks] Re: Problem on overflow

2011-08-27 Thread Dave
@Abishek: I was brain-dead in my earlier posting. Let me try again: If either number is zero, the sum will not overflow. If the numbers have different signs, the sum will not overflow. If both numbers are positive, overflow will occur if b > maxint - a. If both numbers are negative, overflow will

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread Abhishek
@Dave: i didn't understand, suppose a=3, b=31000 and MaxInt=32000; you are saying if (MaxInt-a)>=b; then overflow will occur. but here condition is not satisfying. plz explain. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread Kunal Patil
@Dave: +1 for nice solution... :) On Sat, Aug 27, 2011 at 10:12 PM, Dave wrote: > @Avinash: What do you mean by "exceeding limit(already overflowed)"? > The number maxint is the limit. Every positive number is <= maxint. > > Dave > > On Aug 27, 10:31 am, "Avinash LetsUncomplicate.." 2...@gmail.

Fwd: [algogeeks] Re: String passing

2011-08-27 Thread raj kumar
"monsters are monsters" -- Forwarded message -- From: raj kumar Date: Sat, Aug 27, 2011 at 10:30 PM Subject: Re: [algogeeks] Re: String passing To: algogeeks@googlegroups.com can't understand what are you trying to say source -- You received this message because you are subs

[algogeeks] 2 Binary trees are isomorphic?

2011-08-27 Thread bugaboo
Considering the definition of binary tree isomorphism is the following: - 2 binary trees are isomorphic if they have the same structure but differ just by values. What is the logic (or pseudo code) for checking if two binary trees are isomorphic? -- You received this message because you are subs

Re: [algogeeks] Re: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-27 Thread saurabh modi
yeah...right,...i understand nowthanks anyway. -- 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...@googlegro

Re: [algogeeks] Re: String passing

2011-08-27 Thread raj kumar
can't understand what are you trying to say source -- 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...@googlegr

[algogeeks] Re: String passing

2011-08-27 Thread rahul sharma
coz in funtion array decays to pointer to one d array...correct if wrng??? On Aug 27, 9:52 pm, raj kumar wrote: > modify(char a[],char *b) > { >   a[0]='a'//gives runtime error why? >   b[0]='b'//gives runtime error > > } > > main() > { >   char p[]="hello"; >  char *x="hello"; >  x[0]='x';//will

[algogeeks] Anubhav Agrawal wants to chat

2011-08-27 Thread Anubhav Agrawal
--- Anubhav Agrawal wants to stay in touch better using some of Google's great new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-eb24fc4dd3-cba190743d-scpOdf0ST8vhVqwjmIhB6pAk0_c You'll n

[algogeeks] String passing

2011-08-27 Thread raj kumar
modify(char a[],char *b) { a[0]='a'//gives runtime error why? b[0]='b'//gives runtime error } main() { char p[]="hello"; char *x="hello"; x[0]='x';//will give run time error i know why p[0]='p' //works fine i know why modify("string","pointer"); } why un function modify both the assi

[algogeeks] Re: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-27 Thread Dave
@Saurabh: Again, this solution is not O(log(quotient)), but O(log(quotient)^2). Consider a = 15, b = 1. On the first call, the while loop increments k 4 times. On the first recursive call, k is incremented 3 times, then 2 times, and then 1 time. This is a total of 10 executions of the statement k++

[algogeeks] Re: Problem on overflow

2011-08-27 Thread Dave
@Avinash: What do you mean by "exceeding limit(already overflowed)"? The number maxint is the limit. Every positive number is <= maxint. Dave On Aug 27, 10:31 am, "Avinash LetsUncomplicate.." wrote: > @dave if number a is entered exceeding limit(already overflowed) then > a goes negative(if a wa

Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread Gaurav Menghani
You might want to check out Pollard Rho algorithm. On Sat, Aug 27, 2011 at 9:57 PM, Rahul Verma wrote: > I am trying to submit solution for the SPOJ DIVSUM problem, but it returns > the time limit exceeded. Code submitted by me is below: > > #include > #include > using namespace std; > int prop

[algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread Rahul Verma
I am trying to submit solution for the SPOJ DIVSUMproblem, but it returns the *time limit exceeded*. Code submitted by me is below: #include #include using namespace std; int proper_divisor(int number); int main() { int test,i,number; cin>>test;

[algogeeks] Re: prog

2011-08-27 Thread Navneet
You should read chapter 1 of any good DBMS book like Ramakrishna etc. RDBMS is about tables(containing field values) and relations between them. A DBMS can also be maintained in simple files but RDBMS offers lot of advantages over file based data management. On Aug 27, 7:09 pm, ajit kumar wrote:

[algogeeks] Re: microsoft

2011-08-27 Thread sindhu
these r some of the questions tht i remember.. first 4 questions are 1 mark simply questions asking 2 write the output...each 1 mark 4. one sql questions asking 2 write 3 queries.. learn group by and other clauses.. they asked questions like find the person who owns most number of vehicles...sth li

[algogeeks] Re: pointer query

2011-08-27 Thread sourabh
I am not sure if that's the right question. As far as *char p goes--- its invalid. But both the following statements are valid and have specific meaning: 1) const char *p or char const *p 2) char * const p On Aug 27, 7:43 pm, raj kumar wrote: > what's the difference between char* p and *char

Re: [algogeeks] Re: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-27 Thread saurabh modi
haha yeah okay..that can be done :-) i had forgotten abt * -- 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...@g

Re: [algogeeks] Re: Recruitment Procedure for Microsoft Research Redmond and Bangalore

2011-08-27 Thread sagar pareek
Well i only attended MSR b'lore summer school but sorry no idea interns On Sat, Aug 27, 2011 at 7:23 PM, shady wrote: > anyone with research background ? > > > On Sat, Aug 27, 2011 at 1:57 AM, shady wrote: > >> Does anyone know about the recruitment procedure for Research Intern at MS >> Redmon

[algogeeks] Help!!

2011-08-27 Thread jestincobol nair
Hi folks ! I am able to clear the aptitude round of placement but i will not be called for the second interview round in the first interview round they will not ask much questions and what ever they wil ask i will answer dem correctly only . This has happened with me twice!! i am ser

Re: [algogeeks] Re: amazon ques :Online round

2011-08-27 Thread Piyush Grover
pardon 1 small mistake instead of if(i == 0 || i == n) return (lower, upper); it should be if(i == lower || i == upper) return (lower, upper); On Sat, Aug 27, 2011 at 8:31 PM, Piyush Grover wrote: > satisfy the point on lines, for point(x,y) to lie in between the two, the > f(x,y) value w

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread Avinash LetsUncomplicate..
@dave if number a is entered exceeding limit(already overflowed) then a goes negative(if a was entred just more than limit ) /a goes positive (if a was entred sufficiently more than limit ) maxint -a>=b concept fails Avinash Katiyar NIT Allahabad -- You received this message because you are s

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 ema

Re: [algogeeks] Re: amazon ques :Online round

2011-08-27 Thread Piyush Grover
satisfy the point on lines, for point(x,y) to lie in between the two, the f(x,y) value would have different sign. This can be done using the binary search approach. Here is the pseudo code: f(x,y) = Ax + By - C (x0, y0) initial Call: SearchLines(f, n/2, 0, n); SearchLines(f, i, lower, upper){ if(i

[algogeeks] Re: Problem on overflow

2011-08-27 Thread Dave
@Prags: Pseudocode: If either number is zero, the sum will not overflow. If the numbers have different signs, the sum will not overflow. If both numbers are positive, overflow will occur if maxint - a >= b. If both numbers are negative, overflow will occur if maxint + a >= -b. Dave On Aug 27, 8:

Re: [algogeeks] Re: SPOJ ACODE

2011-08-27 Thread Piyush Kapoor
You can check your answers on my AC code:: import java.io.*; import java.util.*; public class Main { public static void main(String args[])throws Exception { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); StringBuffer out=new StringBuffer("");

[algogeeks] Re: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-27 Thread Dave
@Saurabh: According to the statement of the problem using multiplication is not allowed, but you can replace (1< wrote: > I think that this code can suffice. > > http://www.ideone.com/ESW8Z > > #include > > int solve(int,int); > > int main() > { >  printf("%d",solve(100,10)); >  return 0; > > } > >

Re: [algogeeks] pointer query

2011-08-27 Thread sukran dhawan
invalid On Sat, Aug 27, 2011 at 8:13 PM, raj kumar wrote: > > what's the difference between char* p and *char p > > Source samsung inteview > I think the second one is invalid please also tell can we use expression of > second form anywhere > > thanks > > -- > You received this message because y

[algogeeks] pointer query

2011-08-27 Thread raj kumar
what's the difference between char* p and *char p Source samsung inteview I think the second one is invalid please also tell can we use expression of second form anywhere thanks -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to thi

Re: [algogeeks] array sum

2011-08-27 Thread Neha Singh
@Ankit: Ur solution has some flaws I think. Ur solution assumes that we r dividing the sorted array into 2 halves, but the question says: divide an integer array into 2 sub-arrays and make their averages equal. Take some test case and apply ur solution to it. We cud do this problem in the followi

[algogeeks] Does sub-tree preserve structure?

2011-08-27 Thread bugaboo
Does a sub-tree of a tree imply that it preserves structure as well? Consider the following: - Tree 'T' has node 'A' as root and 'B' as left child - Tree 'S' has node 'A' as root and 'B' as right child Is 'S' a sub-tree of 'T'? -- You received this message because you are subscribed to the Googl

[algogeeks] IBM

2011-08-27 Thread ajit kumar
criteria of ibm and section of test deatils -- 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/-/v5368I1u1pwJ. To post to this group, send email to algogeeks@goo

[algogeeks] prog

2011-08-27 Thread ajit kumar
difference bet rdbms and dbms -- 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/-/P7d8COO2mqQJ. To post to this group, send email to algogeeks@googlegroups.com.

Re: [algogeeks] Tejas Network Placement Process!!!

2011-08-27 Thread sagar pareek
Yeah i wanna know abt it... On Fri, Aug 26, 2011 at 9:22 PM, rohit wrote: > Please share Process and experience of tejas Network for software > profile. > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group

[algogeeks] Problem on overflow

2011-08-27 Thread Prags
Two numbers are given as input check if their sum will be overflow or not ?? Give a successfull running code for 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 unsubscri

[algogeeks] Re: Recruitment Procedure for Microsoft Research Redmond and Bangalore

2011-08-27 Thread shady
anyone with research background ? On Sat, Aug 27, 2011 at 1:57 AM, shady wrote: > Does anyone know about the recruitment procedure for Research Intern at MS > Redmond or MS Bangalore ? What are the type of questions do they ask and > what should be paid attention to ? > There are lot of posts on

Re: [algogeeks] MICROSOFT

2011-08-27 Thread shady
check out the archives On Sat, Aug 27, 2011 at 7:10 PM, teja bala wrote: > Hi Guys > If u are aware of microsoft written test please give me suggestions > and send the respective links > that i can work on... > > -- > You received this message because you are subscribed to the Googl

Re: [algogeeks] Re: Microsoft written!!!

2011-08-27 Thread aditi garg
This grp is full of MS interview ques..search the archives... On Sat, Aug 27, 2011 at 6:55 PM, teja bala wrote: > > > if any one aware of microsoft written test please give me the suggestions > and respective links > thx. > > -- > You received this message because you are subscribed t

[algogeeks] MICROSOFT

2011-08-27 Thread teja bala
Hi Guys If u are aware of microsoft written test please give me suggestions and send the respective links that i can work on... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googl

Re: [algogeeks] Re: Microsoft written!!!

2011-08-27 Thread teja bala
if any one aware of microsoft written test please give me the suggestions and respective links thx. -- 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 fr

[algogeeks] Dead code removal for c program

2011-08-27 Thread john robin
Hi, I've an interesting task. Given a c program say hi.c as input to a program, the program should be able to return a file hi1.c such that all dead codes are removed from the source code submitted. refer link to know abt dead code http://en.wikipedia.org/wiki/Dead_code_elimination int main(vo

Re: [algogeeks] Re: amazon ques :Online round

2011-08-27 Thread Piyush Grover
I don't understand your point if y[i] < y[i+1] how come the slope is positive? It's just that the i'th line will lie under line i+1th line. On Sat, Aug 27, 2011 at 5:11 PM, monish001 wrote: > If I correctly understood the question, It says: > 1. 0<= x[i] <=1 for all i and for all x of line i. >

[algogeeks] Re: Microsoft written!!!

2011-08-27 Thread Vikram Singh
in above example... is the leftmost right cousin of 8 and 9, NULL or 12?? On Aug 10, 4:36 pm, Brijesh Upadhyay wrote: > thank u , i couldnot  have answered this :P -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send

[algogeeks] Re: amazon ques :Online round

2011-08-27 Thread monish001
If I correctly understood the question, It says: 1. 0<= x[i] <=1 for all i and for all x of line i. 2. y[i] wrote: > You are given n no. of lines in form of Ax + By = C, basically you are given > A[i], b[i] and C[i] for line "i". > Lines are given in a way such that 0 <= x[i] <= 1 and y[i] < y[i+1]

Re: [algogeeks] Winshuttle Pattern and Question *Urgent*

2011-08-27 Thread SANDEEP CHUGH
@birju : Samsung nhi leni kya?? On Sat, Aug 27, 2011 at 12:45 PM, Brijesh wrote: > Can anyone please post the pattern and questions asked by winshuttle , > as it is coming to my college tomorrow..?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Ge

Re: [algogeeks]

2011-08-27 Thread UTKARSH SRIVASTAV
thnx dipit i was not able to catch that On Sat, Aug 27, 2011 at 2:54 AM, dipit grover wrote: > Because for the first iteration, while loop isnt executed and hence flag > isnt set any value. But the condition for checking value in flag variable is > evaluated when it doesnt have any initialised v

Re: [algogeeks]

2011-08-27 Thread Amol Sharma
ohh...got it -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sat, Aug 27, 2011 at 3:24 PM, dipit grover

Re: [algogeeks]

2011-08-27 Thread dipit grover
Because for the first iteration, while loop isnt executed and hence flag isnt set any value. But the condition for checking value in flag variable is evaluated when it doesnt have any initialised value. Hence the runtime error. On Sat, Aug 27, 2011 at 3:18 PM, Amol Sharma wrote: > why it is happ

  1   2   >