Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
For Dev-C++, you have to include one file in another. So either add *#include file1.c *in file2.c and compile file2.c or add *#include file2.c *in file1.c and compile file1.c. Hope this helps. *Neeraj Gangwar* B.Tech. IV Year Electronics and Communication IDD Indian Institute of Technology

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
the source program; other files may contain extern declarations to access it. (There may also be extern declarations in the file containing the definition.) Array sizes must be specified with the definition, but are optional with an extern declaration. *Neeraj Gangwar* B.Tech. IV Year Electronics

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
be extern declarations in the file containing the definition.) Array sizes must be specified with the definition, but are optional with an extern declaration. *Neeraj Gangwar* B.Tech. IV Year Electronics and Communication IDD Indian Institute of Technology Roorkee Contact No. : +91 9897073730 On Fri

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
Ignore last to last mail. Sorry. Expand previous mail. *Neeraj Gangwar* B.Tech. IV Year Electronics and Communication IDD Indian Institute of Technology Roorkee Contact No. : +91 9897073730 On Fri, Nov 16, 2012 at 11:49 PM, Neeraj Gangwar y.neeraj2...@gmail.comwrote: Yes, it would be like

Re: [algogeeks] C o/p adobe

2012-11-16 Thread Neeraj Gangwar
Ignore last to last mail. Sorry. Do show expanded content in last mail. On 16 Nov 2012 23:49, Neeraj Gangwar y.neeraj2...@gmail.com wrote: Yes, it would be like copying the code in the other file. You have to find a way to do it in Dev-C++. In linux it's simple. Just use *gcc file1.c file2.c

Re: [algogeeks] C o/p adobe

2012-11-15 Thread Neeraj Gangwar
Which compiler are you using ? Are you compiling both the files together ? *Neeraj Gangwar* B.Tech. IV Year Electronics and Communication IDD Indian Institute of Technology Roorkee Contact No. : +91 9897073730 On Thu, Nov 15, 2012 at 9:10 PM, rahul sharma rahul23111...@gmail.comwrote: but how

Re: [algogeeks] C o/p adobe

2012-11-15 Thread Neeraj Gangwar
That's why you are getting the error. You have to compile both the files together. Search on google. I don't use dev c++. *Neeraj Gangwar* B.Tech. IV Year Electronics and Communication IDD Indian Institute of Technology Roorkee Contact No. : +91 9897073730 On Thu, Nov 15, 2012 at 11:32 PM

[algogeeks] Problem in Step Into (F5) in eclipse Debugging Mode.

2012-11-05 Thread neeraj
1. public static void main(String[] args) { 2. HashMapString,String hashTable =new HashMapString,String(); 3. hashTable.put(one,one); 4. hashTable.put(two,one); 5. } I put break points on line 3 and 4. When i launch my above code in debugging mode

Re: [algogeeks] permutations using a stack

2012-10-23 Thread neeraj bagga
http://en.wikipedia.org/wiki/Catalan_number On Sun, Oct 21, 2012 at 4:00 PM, Shruti Gupta fundooshr...@gmail.comwrote: if n=1,2,3 n we denote Push by P and Pop by X the we can generate following permutations : 1) PPPXXX = 321 2) PPXXPX = 213 3) PXPXPX = 123 4) PXPPXX = 132 5) PPXPXX =

Re: [algogeeks] Amazon Interview Question

2012-01-18 Thread NEERAJ KODDHAN
int[] a = new int[2*n]; put(a, n); static void put(int[] a,int i){ if(i0){ for(int j=0;ja.length-i-1;j++){ if(a[j]==0 a[j+i+1]==0){ a[j]=i; a[j+i+1]=i; put(a, i-1); a[j]=0; a[j+i+1]=0; } } }else if(i==0){ for (int k : a) { System.out.print(k + ); } System.out.println(); } } On Wed, Jan

Re: [algogeeks] Re: microsoft paper that i wrote today..

2011-08-12 Thread Neeraj Gupta
Ques 5 might be value of 1+2+'4' https://ideone.com/8b91t Obviously if we use , then it represents string and we can't define + operation with other operand being an integer. On Fri, Aug 12, 2011 at 11:06 PM, Anil Arya anilarya...@gmail.com wrote: Q.5 . [warning] initialization makes

Re: [algogeeks] o/p

2011-08-08 Thread Neeraj Gupta
Precedence of + is higher than ? On Mon, Aug 8, 2011 at 3:27 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: #include stdio.h #define max(a,b)(ab)?a:b int main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(%d,%d,m,n); getchar(); return 0; } y the o/p is

Re: [algogeeks] mcq

2011-08-08 Thread Neeraj Gupta
As it's given that array is searched using BS, then it's quite obvious that they are sorted. Also, if that's not the case, then the complexity will be O(N/P log(N/P)) for sorting and O(Log(N/P)) for search. Not given as an option. On Mon, Aug 8, 2011 at 5:09 PM, Kamakshii Aggarwal

Re: [algogeeks]

2011-07-30 Thread Neeraj Gupta
Create a balance BST. Maintain counter. Whenever You hit duplicate increase the counter while inserting. O(nlogn) for creating it and O(N) space. Now while traverse the array. If you find the element, then print it acco the counter value. After printing delete it. if not found continue traversing.

Re: [algogeeks] Re: Array doubt

2011-07-30 Thread Neeraj Gupta
Create a balance BST. Maintain counter. Whenever You hit duplicate increase the counter while inserting. O(nlogn) for creating it and O(N) space. Now while traverse the array. If you find the element, then print it acco the counter value. After printing delete it. if not found continue traversing.

Re: [algogeeks] Output Help.

2011-07-30 Thread Neeraj Gupta
Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any operation is not standard. http://ideone.com/bJBGl http://ideone.com/bJBGl On Sun, Jul 31, 2011 at 1:38 AM, aditi garg aditi.garg.6...@gmail.comwrote: it would be undefined... On Sun, Jul 31, 2011 at 1:34

Re: [algogeeks] Re: Array doubt

2011-07-30 Thread Neeraj Gupta
Yes, i agree, it will increase the code complexity only. you can just set the counter to -ve value only. On Sun, Jul 31, 2011 at 1:38 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: @neeraj:deleting after printing will adds to complexity.. On Sun, Jul 31, 2011 at 1:34 AM, Neeraj Gupta

Re: [algogeeks] size of self referential structure

2011-07-26 Thread Neeraj Gupta
28.? int a- 4 Five array of pointer to char 20( each pointer of 4 bytes) struct node * 4 bytes. On Tue, Jul 26, 2011 at 6:10 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: #includestdio.h #includestddef.h struct node{ int a; char *b[5]; struct node *link; };

Re: [algogeeks] C doubt!

2011-07-25 Thread Neeraj Gupta
On Tue, Jul 26, 2011 at 1:43 AM, Nitish Garg nitishgarg1...@gmail.comwrote: This following code produces output as 8 4 4. 8 is fine, as the size of an int plus a pointer is 8, but why the size of p and q is being shown as 4? #includestdio.h#includestdlib.hint main(){ struct node

Re: [algogeeks] Re: Microsoft Question!

2011-07-21 Thread Neeraj Gupta
Ankit's Solution is actually based on the assumption that we will only reverse bits till MSB which is set. So, for 0100 It will reverse will 100, so the answer should be one. On 7/21/11, aditi garg aditi.garg.6...@gmail.com wrote: i have tried solving so many tyms bt i dnt think dis also is

Re: [algogeeks] Re: Microsoft Question!

2011-07-21 Thread Neeraj Gupta
Yes, that's correct what is wrong with that? Basically when n1 occurs, it kind of initiates the multiplication by m by setting m+=1. So, After that, m gets multiplied by 2 which is nothing but left shift by 1. n=100 m remains 0 as n1==0 so m=0; n- 10; 2. n=10 m*2- m=0; n1=0 so m=0; n-1; 3 n=1;

Re: [algogeeks] Some basic bit fiddling

2011-07-18 Thread Neeraj Gupta
UB. http://ideone.com/Dwof8 On Tue, Jul 19, 2011 at 12:26 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: please try this cout(134); // gives output 0 int i=1; i=i34; couti ; //gives 4 as out put , why ? -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of

[algogeeks] Problem: Longest Increasing Seq code

2011-07-15 Thread Neeraj Gupta
Hi, Can anyone help me in understanding the following code http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence.cpp I am not able to understand what is the exact purpose of vector p in the above mentioned code. A little detail explanation will be helpful. ~Neeraj -- You

[algogeeks] Re: Problem: Longest Increasing Seq code

2011-07-15 Thread Neeraj Gupta
is caused by this search. Since A is always ordered in increasing order, and the operation does not change this ordering, we can do a binary search for every single a1, a2, ... , an. * ~Neeraj Hi, -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] microsoft ques

2011-07-13 Thread Neeraj Gupta
Oppalis algo- Please let me know if there is a bug in it. http://www.ideone.com/u1m07 On Wed, Jul 13, 2011 at 11:36 AM, Aniket Dutta aniketdutt...@gmail.comwrote: @sunny: right thanks for correcting On Wed, Jul 13, 2011 at 11:33 AM, sunny agrawal sunny816.i...@gmail.comwrote: @Aniket

Re: [algogeeks] Re: questions related to C

2011-07-12 Thread Neeraj Gupta
http://www.cplusplus.com/reference/algorithm/swap/ On Wed, Jul 13, 2011 at 10:40 AM, Aniket Dutta aniketdutt...@gmail.comwrote: what about a generic swap function which works for structures also? On Wed, Jul 13, 2011 at 2:23 AM, Don dondod...@gmail.com wrote: To check for overflow, use

[algogeeks] Re: SPOJ problem code:MAJOR

2011-02-14 Thread NEERAJ ARORA
I simply used arrays to count the frequency of each numberMy accepted solution is: #includestdio.h int main() { int t,n,i,p,x,chk,k; int pos[1000]; int neg[1000]; int nos[100]; scanf(%d,t); while(t--) { chk=0;

[algogeeks] WA spoj

2011-02-12 Thread NEERAJ ARORA
my code working for given test cases but it is giving WA. #includeiostream using namespace std; struct party { float fun; float money; float ratio; }p[100]; int main() { party tmp; float b,n; while(1) { cinbn;

[algogeeks] Re: WA spoj

2011-02-12 Thread NEERAJ ARORA
Problem name is party www.spoj.pl/problems/PARTY On Feb 13, 1:46 am, Wladimir Tavares wladimir...@gmail.com wrote: What's the problem in spoj? Wladimir Araujo Tavares *Federal University of Ceará * On Sat, Feb 12, 2011 at 3:00 PM, NEERAJ ARORA neerdel...@gmail.com wrote: my code working

Re: [algogeeks] file handling

2010-12-14 Thread neeraj agarwal
programs for basic operation. -- 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. For more

[algogeeks] file handling

2010-12-12 Thread neeraj agarwal
i am facing problem in file handling in C can any one suggest me how to implement them. -- 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

[algogeeks] optimization in huffman compression

2010-11-25 Thread neeraj agarwal
can any one suggest me some optimization in huffman text compression. with code. -- 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] path in binary tree

2010-11-07 Thread neeraj agarwal
write an algorithm to print the path from root to every leaf node in binary tree. -- 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] compression

2010-11-04 Thread neeraj agarwal
i have a file contain only 0's and 1's, how can i compress it efficiently. say for e.g (000101010110110101001011101011101010101010. . )obviously order of 1

Re: [algogeeks] linked lists

2010-10-07 Thread neeraj agarwal
will replace next of 'c' in first list to next of 'c' in list l2... now l3 ={a,b,c,d,e,f} my comlexity is 0(length of list l1). -neeraj -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge

Re: [algogeeks] Re: Bitwise operator - Adobe

2010-10-05 Thread neeraj agarwal
here for the next multiple of 8 i have 3 different solutions ... 1)... nextmultiple = (n/8+1)*8 2)... nextmultiple= n+(8-n%8) 3)... suppose i have 32-bit compiler for(i=32; i1; i--) { if((pow(2,i)n==0)(pow(2,i-1)n!=0)) {

Re: [algogeeks] Re: Amazon Question-Linux Shell

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

Re: [algogeeks] Re: Amazon interview Question (Array yet again!)

2010-08-28 Thread Neeraj Gupta
On Sun, Aug 29, 2010 at 1:35 AM, Gene gene.ress...@gmail.com wrote: My algorithm proposal wasn't correct, but I can't see how to get 8. You need to decrement 14, 15, 16, 13 to 11. This costs 14. So do I. May be he has not noticed that incrementing a number is not an option. ;) On Aug 28,

[algogeeks] Coding Problems

2010-02-02 Thread Neeraj Singh
Hey fellas, I need to seek some advice from you all. I have recently developed strong interest in programming problems. So, What is the best place I should start practicing my skills. It would be great if the effort is rewarding as well. Thanks in advance. TY -- Neeraj Ted Turner http

Re: [algogeeks] Coding Problems

2010-02-02 Thread Neeraj Singh
On Tue, Feb 2, 2010 at 8:56 PM, vikas mehta mehta...@gmail.com wrote: i will recommend u usaco training gateway. it is awesome On Tue, Feb 2, 2010 at 2:54 AM, Neeraj Singh 17.neera...@gmail.comwrote: Hey fellas, I need to seek some advice from you all. I have recently developed strong

[algogeeks] Re: random number [a....b]

2009-10-06 Thread Neeraj Singh
...@gmail.comwrote: neeraj and anilkumarmyla yr codes r not giving numbers with equal probability here is the code #includeiostream #includetime.h #includestdlib.h using namespace std; int random(int a,int b) { return (a+(rand()%(b-a+1))); } int random1(int a,int b) { int mid

[algogeeks] Re: random number...

2009-09-19 Thread Neeraj Singh
, but only 6 / 125 in the second. -- Neeraj Kumar B.Tech (Part III) Department of Computer Sc. Engineering IT-BHU,Varanasi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Un-sort

2009-09-11 Thread Neeraj Kr.
There are numbers list starting from 1 to n,placed randomly. To sort these numbers an algorithm is used. Starting from the left, one by one; move a number in left direction until there is no greater number to the left of the number. Input: The left moves requires for each position to sort are