Re: [algogeeks] Re: swap objects without temp variable

2012-11-19 Thread abhinav gupta
we need to use + and - as operator overloading. so, that i will work f9 for ur objects. so make operator overloading for + and - operator. On Sat, Nov 17, 2012 at 9:12 PM, AISHWARYA KUMAR aish@gmail.com wrote: in one line a=a^b^(b=a) ; -- -- *Thanks and

[algogeeks] MS: searching problem......help me out...

2012-06-03 Thread abhinav gupta
We have given a list 14 6 7 15 8 9 we have to find 15 in (log n ) times. -- *Thanks and Regards,* Abhinav Kumar Gupta **abhinav@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

Re: [algogeeks] MS: searching problem......help me out...

2012-06-03 Thread abhinav gupta
you can stop.. although space complexity has increased... you will need one redundant array to use heap operation so that finally you will have original array as it is... Thanks and Regards: Rahul Kumar Patle On Sun, Jun 3, 2012 at 8:31 PM, abhinav gupta abhinav@gmail.comwrote: We

Re: [algogeeks] MS: searching problem......help me out...

2012-06-03 Thread abhinav gupta
@ Abhishek : Link that you have provided is for kth min element in the unsorted array, but here i dont know the given value is of at what min position. On Sun, Jun 3, 2012 at 9:06 AM, abhinav gupta abhinav@gmail.com wrote: @Rahul: but for heapify, i need to build heap tree first from

Re: [algogeeks] ARICENT PATTERN

2012-02-21 Thread abhinav gupta
Aricent will not conduct test by itself. They'll have other organization who will conduct the exams. There are many test to be conducted in the time period of 2 or more. i just forgot the time limit limit. But the exams on apptitute, c language/java language either of one, technical test, verbal

Re: [algogeeks] Qualcomm

2011-09-23 Thread abhinav gupta
@vijay can u plz shar some ques which will help us On Fri, Sep 23, 2011 at 5:20 PM, vijay singh vijaysinghb...@gmail.comwrote: Yes, it already visited.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Re: error in c++ program

2011-09-22 Thread abhinav gupta
@rahul +1 On Thu, Sep 22, 2011 at 11:20 PM, rahul vatsa vatsa.ra...@gmail.com wrote: time is a keyword in c/cpp, change time to any other string in ur code nd it will work. On Thu, Sep 22, 2011 at 12:27 PM, Rajesh Kumar testalgori...@gmail.comwrote: not working by changes provide by you

Re: [algogeeks] C++ Query

2011-09-20 Thread abhinav gupta
Whenver you call copy constructor it has to pass reference parameter beacuse you dont want constructor and destructor to be called twice. Here is the reason why, Suppose u have two objects of a class (let 'a' and 'b'). when u want to copy 'a' into 'b' you want current status of object 'a' to be

Re: [algogeeks] Re: prime factorization algo

2011-09-20 Thread abhinav gupta
@ Tammana : Can u explain the main logic of haveFactor() function inside Prime.? On Tue, Sep 20, 2011 at 11:28 AM, Tamanna Afroze afroze...@gmail.comwrote: haveFactor() function checked the factor of a number. if a number has a factor other than 1 and itself it isn't prime. Operation function

Re: [algogeeks] Re: prime factorization algo

2011-09-20 Thread abhinav gupta
Dats not the logic Tammana you have to check whether there is any factor in between 2 to number/2; if there is any no then u have to brak at that point. On Tue, Sep 20, 2011 at 12:10 PM, Tamanna Afroze afroze...@gmail.comwrote: I checked whether th enuber s divisible by 2 nd 3 repeatedly...

Re: [algogeeks] Re: prime factorization algo

2011-09-20 Thread abhinav gupta
Welcum ! I think we need to discuss this 1 in gtalk...I think u still need sm clarification in this 1 On Tue, Sep 20, 2011 at 12:33 PM, Tamanna Afroze afroze...@gmail.comwrote: Thanks to all for the nice suggestions. thanks @abhianv and @siddhart. I will try all the suggestions.. Tamanna

Re: [algogeeks] Question --

2011-09-20 Thread abhinav gupta
I can tell you the logic.Take two arrays N and M, put their bits in the array. Now using i and j index replace the value of N[j] to n[i] by M[j] to M[i]. On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal ishan.aggarwal.1...@gmail.com wrote: You are given two 32-bit numbers, N and M, and two bit

Re: [algogeeks] Question --

2011-09-20 Thread abhinav gupta
U can use single walker (from 0 till 31) to convert integers N and M into array of bits, then another walker from i to j to replace values. for(k=31;k=0;k++) { N[k]=n 01; M[k]=m 01; n=1; m=1; } for(k=i;k=j;k++) N[k]=M[k]; On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta guptaabhinav

Re: [algogeeks] Re: prime factorization algo

2011-09-20 Thread abhinav gupta
yup i too think so..Dats y I need to discuss this qs wid u. On Tue, Sep 20, 2011 at 12:36 PM, Tamanna Afroze afroze...@gmail.comwrote: @abhinav I think time complexity will be higher for that algorithm -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Question --

2011-09-20 Thread abhinav gupta
Its because o/p should look like dat.Bt dats simple you can do it by multiplying bits to power(2, i) and adding all expressions.Simple! On Tue, Sep 20, 2011 at 1:09 PM, abhinav gupta guptaabhinav...@gmail.comwrote In the first loop bits are added into the array N and M .I have taken two

Re: [algogeeks]

2011-09-20 Thread abhinav gupta
You can parse the array to find address of max element then you can parse second time leaving that particular address to find second largest element. On Tue, Sep 20, 2011 at 12:36 PM, surender sanke surend...@gmail.comwrote: based on minmax in minimum number of comparisons.. struct pa {

Re: [algogeeks] Question --

2011-09-20 Thread abhinav gupta
to k =0? On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta guptaabhinav...@gmail.com wrote: U can use single walker (from 0 till 31) to convert integers N and M into array of bits, then another walker from i to j to replace values. for(k=31;k=0;k++) { N[k]=n 01; M[k]=m 01; n=1; m=1

Re: [algogeeks] Question --

2011-09-20 Thread abhinav gupta
You can also solve the problem by using bit operators. by using| ! . Need sm thinking in dat..No time rite nw! On Tue, Sep 20, 2011 at 1:12 PM, abhinav gupta guptaabhinav...@gmail.comwrote: Its because o/p should look like dat.Bt dats simple you can do it by multiplying bits to power(2, i

Re: [algogeeks] Re: Question --

2011-09-20 Thread abhinav gupta
; On Sep 20, 3:43 pm, abhinav gupta guptaabhinav...@gmail.com wrote: You can also solve the problem by using bit operators. by using | ! . Need sm thinking in dat..No time rite nw! On Tue, Sep 20, 2011 at 1:12 PM, abhinav gupta guptaabhinav...@gmail.comwrote

Re: [algogeeks] getting segmentation fault..

2011-09-20 Thread abhinav gupta
What are the values of n and m you are providing??? On Tue, Sep 20, 2011 at 7:02 PM, deependra dsdeependraprat...@gmail.comwrote: long int n,m; cinnm; long int a[n][m]; a[0][0]=1; for(long int i=1;in;i++) a[i][0]=0;

Re: [algogeeks] getting segmentation fault..

2011-09-20 Thread abhinav gupta
Beacuse memory requird to store (1000 * 1000) bytes is more than stack can hold for the program..Dats y its giving segmentation fault... On Tue, Sep 20, 2011 at 7:29 AM, Deependra pratap singh dsdeependraprat...@gmail.com wrote: for n1000 , m1000... m getting the fault. but lesser than that

Re: [algogeeks] stack

2011-09-20 Thread abhinav gupta
stfu ! On Tue, Sep 20, 2011 at 10:27 AM, prasanth n nprasnt...@gmail.com wrote: In the classic problem of the Towers of Hanoi, you have 3 rods and N disks of different sizes which can slide onto any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom

Re: [algogeeks] Re: random function

2011-09-19 Thread abhinav gupta
for that u have rand() function in c programming just go through it On Mon, Sep 19, 2011 at 8:42 PM, prasanth n nprasnt...@gmail.com wrote: @don: suppose if give like random(5)- it must give any number between 0 and 5.. On Mon, Sep 19, 2011 at 8:22 PM, Don dondod...@gmail.com wrote: You

Re: [algogeeks] Re: random function

2011-09-19 Thread abhinav gupta
int i; i=random(5); int random(int x) { return (rand(x) % 5); } rand() is inbuilt function in c/c++; On Mon, Sep 19, 2011 at 9:24 PM, Don dondod...@gmail.com wrote: The most common way that it works would be that random(n) returns the equivalent of a random integer mod n, so 0=xn. But

Re: [algogeeks] Re: prime factorization algo

2011-09-19 Thread abhinav gupta
@Tammana can u pls give me the logic of the above code ! On Tue, Sep 20, 2011 at 8:35 AM, Tamanna Afroze afroze...@gmail.com wrote: I don't know whether my one is good algorithm or not, but it gives somewhat good output. It is in Java. /* * To change this template, choose Tools |

Re: [algogeeks] Plz explain the output..........

2011-09-17 Thread abhinav gupta
@yogesh :ya u right. On Sat, Sep 17, 2011 at 11:58 AM, sukran dhawan sukrandha...@gmail.comwrote: x== 9 is not an error !!! it simply returns a non zero value if its true and 0 if its false On Sat, Sep 17, 2011 at 11:39 AM, praveen raj praveen0...@gmail.comwrote: This will show syntax

Re: [algogeeks] Math Puzzle

2011-09-15 Thread abhinav gupta
Above expression will be (p^3+q^3+r^3)/pqr if a+b+c=0, then a^3+b^3+c^3 = 3abc so, 3pqr/pqr=3 On Thu, Sep 15, 2011 at 10:59 AM, rahul sharma rahul23111...@gmail.comwrote: hw? On Thu, Sep 15, 2011 at 10:57 AM, Tamanna Afroze afroze...@gmail.comwrote: yah the ans is 3 -- You

Re: [algogeeks] Re: Math Puzzle

2011-09-15 Thread abhinav gupta
Shut up...its 3,, On Thu, Sep 15, 2011 at 9:43 AM, Don dondod...@gmail.com wrote: It might be 3, but it doesn't have to be 3. Don On Sep 14, 11:56 pm, NAGARAJAN SIVARAMAN naga4...@gmail.com wrote: if P+Q+R= 0 then P2 /QR + Q2/PR + R2/PQ = ?? how to solve this?? -- You received

Re: [algogeeks] Re: Math Puzzle

2011-09-15 Thread abhinav gupta
u cnt divide a number by 0..that thing is self undrstod On Thu, Sep 15, 2011 at 9:49 AM, Piyush Grover piyush4u.iit...@gmail.comwrote: Don is right if R = 0, P = 1 and Q = -1 then the given expression is UNDEFINED!!! On Thu, Sep 15, 2011 at 10:16 PM, abhinav gupta guptaabhinav

Re: [algogeeks] Re: Math Puzzle

2011-09-15 Thread abhinav gupta
dude dats outside the domain of the qs...dont be oversmart. On Thu, Sep 15, 2011 at 9:49 AM, Don dondod...@gmail.com wrote: No, not at all. Here is a trivial counterexample: P = Q = R = 0 Don On Sep 15, 11:46 am, abhinav gupta guptaabhinav...@gmail.com wrote: Shut up...its 3

Re: [algogeeks] Microsoft coming to PEC on 19th, any specific pattern for written test

2011-09-15 Thread abhinav gupta
y u all r worried abt MS...open up ur own cmpny... On Thu, Sep 15, 2011 at 10:13 AM, vivek goel vivek.thapar2...@gmail.comwrote: hey ankur. wat's eligibility criteria.. and eligible branches... *mca* is eligible ??. -- You

Re: [algogeeks] Interview Questions

2011-09-15 Thread abhinav gupta
Runtime error.. x pointing to unintialised memory..and then initialised,,, On Thu, Sep 15, 2011 at 11:02 AM, SAMMM somnath.nit...@gmail.com wrote: #includecstdio #includeiostream using namespace std; int main() { int w=10; int *p=w; int *x; *x=1000; int *y; *y=100; printf(%d

Re: [algogeeks] Re: Interview Questions

2011-09-15 Thread abhinav gupta
Runtime error On Thu, Sep 15, 2011 at 11:16 AM, SAMMM somnath.nit...@gmail.com wrote: OK Now try this ... #includecstdio #includeiostream using namespace std; int main() { int w=10; int *p=w; int *x; *x=1000; printf(%d %d ,*x,*p); return 0; } Wht is

Re: [algogeeks] Re: Interview Questions

2011-09-15 Thread abhinav gupta
I dont knw man wat d hell is dis? On Thu, Sep 15, 2011 at 11:19 AM, SAMMM somnath.nit...@gmail.com wrote: No check It once more in G++ Compiler -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] find the error

2011-09-14 Thread abhinav gupta
file not closed. On Wed, Sep 14, 2011 at 5:56 PM, ravi maggon maggonr...@gmail.com wrote: Something like this was asked in written test of Tally. We had to find the cause why this program crased during run time. File *f; int count=0; if(f=fopen(file.txt,r)) { while(f.get()!=EOF)

Re: [algogeeks] program

2011-09-14 Thread abhinav gupta
Create a structure with num,count(of num) and link parse the array and create nodes (nodes are created with id=num). when the no of nodes == 3 print the nodes data and count. On Wed, Sep 14, 2011 at 5:13 PM, parag khanna khanna.para...@gmail.comwrote: find the frequencies of each alphabet ...

Re: [algogeeks] Re: informatica pattern and question of interview

2011-09-14 Thread abhinav gupta
Informatica sucks.I have topped in its offcampus written test still they din call me. On Wed, Sep 14, 2011 at 7:05 PM, ravi maggon maggonr...@gmail.com wrote: In Thapar Criteria was BE CSE and I think MCA was also eligible but for interviews only BE CSE were shortlisted. Package: 7.75

Re: [algogeeks] Re: branching factor when BFS and DFS of a graph is same

2011-09-14 Thread abhinav gupta
@siddharam: i think the above example is isomorphic because in isomopic we check for the degree of each node in one tree to the corresponding degree of another tree is present or not . like eg:- p-q--r---s is isomorphic with a--b--c---d On Thu, Sep

Re: [algogeeks] plzzzzzzzz heeeppppp!!!!!!!!!!1

2011-09-14 Thread abhinav gupta
in my opinion developer profile is better than testing...one On Thu, Sep 15, 2011 at 10:57 AM, rahul sharma rahul23111...@gmail.comwrote: hey guys plz tell the difference b/w testing n develp. profile ??? n joing i n testing profile has growth as much as in develpoer???plz tell soon..?should

Re: [algogeeks] samsung engineering lab interview..

2011-09-13 Thread abhinav gupta
they'll ask question on mostly on c programming and O.S. on thread, process concepts On Tue, Sep 13, 2011 at 6:46 PM, sourabh jain sourabhjain...@gmail.comwrote: if any one who have selected for samsung ,please tell me the type of ques.that can be ask by tech interview.. --

Re: [algogeeks] SAMSUNG INDIA SOFTWARE OPERATIONS PVT LTD (SISO)

2011-09-13 Thread abhinav gupta
NIT ALLAHABAD... On Tue, Sep 13, 2011 at 7:45 PM, navneet kumar kumarnavneet@gmail.comwrote: which college?? On Tue, Sep 13, 2011 at 7:41 PM, abhinav gupta abhinav@gmail.comwrote: any one plzz tell me what they will ask in written test... and which type of question

Re: [algogeeks] String

2011-09-12 Thread abhinav gupta
First reverse the whole string then reverse the individual words .Simple ! On Mon, Sep 12, 2011 at 11:08 AM, guna sekaran vgun...@gmail.com wrote: String Reverse: input : welcome to all output: all to welcome -- You received this message because you are subscribed to the Google

Re: [algogeeks] plz help for C output

2011-09-10 Thread abhinav gupta
a) 100 On Sat, Sep 10, 2011 at 12:40 AM, abhishek abhishek.ma...@gmail.com wrote: (a) #define f(g,g2) g##g2 int main() { int var12=100; printf(%d,f(var,12)); getch(); } what will be the output?? (b) main() { int i=400,j-300; printf(%d...%d); } (c) void main() {

Re: [algogeeks] Re: How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread abhinav gupta
temp2 is second largest element. On Sat, Sep 10, 2011 at 8:00 AM, abhinav gupta guptaabhinav...@gmail.comwrote: I can solve this problem in O(n) i=0; temp1=arr[0]; while(i != len) { if(arr[i] temp1) { temp2=temp1; temp1=arr[i] } i++; } On Sat, Sep 10, 2011 at 7:42 AM, Dave

Re: [algogeeks] Re: How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread abhinav gupta
Oops ..no u hav to quicksort it. On Sat, Sep 10, 2011 at 8:24 AM, Dave dave_and_da...@juno.com wrote: @Abhinav: Does it work correctly on {1, 3, 2}, or, for that matter, on any array where the second largest comes after the largest? Dave On Sep 10, 10:16 am, abhinav gupta guptaabhinav

Re: [algogeeks] Re: How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread abhinav gupta
, abhinav gupta guptaabhinav...@gmail.comwrote: Oops ..no u hav to quicksort it. On Sat, Sep 10, 2011 at 8:24 AM, Dave dave_and_da...@juno.com wrote: @Abhinav: Does it work correctly on {1, 3, 2}, or, for that matter, on any array where the second largest comes after the largest? Dave On Sep