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 dip10c...@gmail.com

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 vijaykhand...@gmail.comwrote: 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

Re: [algogeeks] simple doubt

2011-08-05 Thread Vijay Khandar
I dont think so dp=arr; since **dp; dp contains the addr of another ptr variable... On Fri, Aug 5, 2011 at 7:27 PM, Arun Vishwanathan aaron.nar...@gmail.comwrote: I guess someone had posted a link earlier from which I have a basic doubt when u have int arr[3]={1,0,2}; int **dp; int

Re: [algogeeks] Question

2011-08-05 Thread Vijay Khandar
Yes correct, In m using very old compiler Turbo C++ On Fri, Aug 5, 2011 at 7:34 PM, Rohit Srivastava access2ro...@gmail.comwrote: 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

Re: [algogeeks] Question

2011-08-05 Thread Rohit Srivastava
try using dev or any new 32bit compiler it wont give that error!!! or try using this void linkfloat(void) { float a=0,*b=a; a=*b; } this code forces the emulator to be linked On Fri, Aug 5, 2011 at 7:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Yes correct, In m using very old

Re: [algogeeks] simple doubt

2011-08-05 Thread Arun Vishwanathan
i see but is not arr a pointer to first array element and so arr contain address of that pointer ? On Fri, Aug 5, 2011 at 4:06 PM, Vijay Khandar vijaykhand...@gmail.comwrote: I dont think so dp=arr; since **dp; dp contains the addr of another ptr variable... On Fri, Aug 5, 2011 at 7:27

Re: [algogeeks] Question

2011-08-05 Thread Vijay Khandar
Yes due to this only i m getting proper o/p, but why it is necessary in Turbo C++ compiler.? On Fri, Aug 5, 2011 at 7:41 PM, Rohit Srivastava access2ro...@gmail.comwrote: try using dev or any new 32bit compiler it wont give that error!!! or try using this void linkfloat(void) {

Re: [algogeeks] simple doubt

2011-08-05 Thread Vijay Khandar
but u initialized **dp means . ex-dp=p and p=arr then its correct so dp contains addr of p which inturns contains addrof arr now **dp is correct initialization. On Fri, Aug 5, 2011 at 7:45 PM, Arun Vishwanathan aaron.nar...@gmail.comwrote: i see but is not arr a pointer to first array

[algogeeks] Re: Puzzle

2011-08-05 Thread Lakshmi Prasad
I didn't understand it fully plese explain On Aug 4, 2:48 pm, sagar pareek sagarpar...@gmail.com wrote: double 87.5 gives you 175 100 will be used by 1st well and 75 will be used by second now second well will double the 75 and will give you 150 100 will be used by second and remainder 50

[algogeeks] PTR Q

2011-08-05 Thread Vijay Khandar
Pointers provide a convenient way to represent multidimensional arrays, allowing a single array multidimensional array to be replaced by a lower-dimensional array of pointers. this statement is true or false... Plz Explain -- You received this message because you are subscribed to the

Re: [algogeeks] MS

2011-08-05 Thread muthu raj
Yeah Kadanes algorithm. It can be done in O(n); *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Fri, Aug 5, 2011 at 6:49 PM, Naren s sweetna...@gmail.com wrote: http://people.csail.mit.edu/bdean/6.046/dp/ -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Puzzle

2011-08-05 Thread Tushar Bindal
of this double, half is kept inside the well, and the other half is used as input to the 2nd well half mean 1/2 or 50% how can we assume it to be 100??? if we take it to be 1/2, the question goes wrong, so ur concept is valid but then question should have been framed correctly On Fri, Aug 5,

[algogeeks] output???

2011-08-05 Thread Rajesh Kumar
program output comes - hi why?? #includestdio.h main() { float a=0.7; if(.7 a) printf(hi\n); else printf(hello\n); } -- Regards Rajesh Kumar -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Duplicates in a string

2011-08-05 Thread priya v
Remove duplicate alphabets from a string and compress it in the same string. For example, MISSISSIPPI becomes MISP. O (n2) is not acceptable. For this problem is it a good idea to sort the array using a sorting technique with efficiency O(nlogn) and remove the duplicates? -- You received this

Re: [algogeeks] output???

2011-08-05 Thread kartik sachan
the output will be hi even if u have putted equal to sign there this is becoz 0.7 do not exactly stored like 0.7 in a but some thing lesser as describe in ASCII format that's why it is awlays lesser than 0.7 -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] MICRSOFT WRITEN TEST

2011-08-05 Thread Tushar Bindal
they always repeat questions. go through lined list and trees questions on geeksforgeeks like finding loop in LL, path in a binary tree (not BST) for a given sum, addition of numbers stored digitwise in a linked list. Printing 2d matrix in spiral order, KMP algorithm - these are some questions

Re: [algogeeks] output???

2011-08-05 Thread bagaria.ka...@gmail.com
.7 in float is taken like .699 i blv ? On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan kartik.sac...@gmail.comwrote: the output will be hi even if u have putted equal to sign there this is becoz 0.7 do not exactly stored like 0.7 in a but some thing lesser as describe in ASCII format

Re: [algogeeks] Duplicates in a string

2011-08-05 Thread nishaanth
Store the frequency of all the letters in an array in one scan(like counting sort). In the next pass remove the duplicates and appropriately shift . takes 2 O(n) passes i guess On Fri, Aug 5, 2011 at 4:50 PM, priya v pria@gmail.com wrote: Remove duplicate alphabets from a string and

[algogeeks] array pointer

2011-08-05 Thread Arshad Alam
we can equate base address of double dimension array to a pointer variable, tell me which one is correct. if n is a pointer variable and x[5][5] is double dimension array 1. n=x; 2. n=x[0][0]; 3. both -- You received this message because you are subscribed to the Google Groups

[algogeeks] Samsung SISO Question

2011-08-05 Thread bagaria.ka...@gmail.com
Given a rope of 10m , numbered at 1m i.e like 0 1 2 3 4 5 6 7 8 9 10 ||---|---|---|---|---|---|---|---|---| |---10m| One dry out it clothes of various length like 4m from 0-4 then of 2m from 6-8 then 6m from 2-8 and so on ,one on top of another , then u

Re: [algogeeks] Duplicates in a string

2011-08-05 Thread Sachin Jain
We can do it in just one pass. Start scanning the array and whichever element gets scanned just store some kind of marker in the additional array that this element has been vsisted.Next time you get some element if that element (or character) is not visited earlier than mark it as visited and

Re: [algogeeks] Duplicates in a string

2011-08-05 Thread kartik sachan
I think in this case count sort type thing would work better way just take a array of max 26(as 26 CHARACTER ARE THERE) and using index as count['M']=store how many times M has comes similary store other character now print array whose value 0 but IN this case u might lost the

Re: [algogeeks] Duplicates in a string

2011-08-05 Thread keyan karthi
u can use a bool array size- 26 and do char[i]-'A' = 1 , check it to decide the first instance of the character. this can be done in O(n). u can even use bit mask to make ur code look better ( ;) ) On 8/5/11, priya v pria@gmail.com wrote: If an additional storage is used to store the

[algogeeks] Re: Duplicates in a string

2011-08-05 Thread deepikaanand
static int array[256]; removedupli(char s[],int n) { array[s[0]]=1; for(i=1;in;i++) { if(array[s[i]]==0) array[s[i]]=1; else { for(pos=i;in;i++) s[pos]=s[pos+1]; i--; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] MS

2011-08-05 Thread sukran dhawan
Even adding positive numbers can be done in o(n) ryt !? On Fri, Aug 5, 2011 at 8:04 PM, muthu raj muthura...@gmail.com wrote: Yeah Kadanes algorithm. It can be done in O(n); *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Fri, Aug 5, 2011 at 6:49 PM, Naren s sweetna...@gmail.com

Re: [algogeeks] Re: Printf

2011-08-05 Thread sukran dhawan
Its logical address !! On Fri, Aug 5, 2011 at 5:07 PM, Dipankar Patro dip10c...@gmail.com wrote: +1 to logical address. User programs are never given access to physical address. On 5 August 2011 17:00, muthu raj muthura...@gmail.com wrote: physical adress is never acessible.Those who

[algogeeks] Re: MICRSOFT WRITEN TEST

2011-08-05 Thread Agyat
Q1 Find shortest distance pair of point among n points in a 2d space. soln:- CLRS(comp geomentry nlogn soln) Q2 design an elevator? soln:- use semaphores,syn construct etc. Q3 reverse every k nodes of a ll? there will be some o/p questions in c if applied for IDC profle and in C++ if applied

Re: [algogeeks] output???

2011-08-05 Thread sukran dhawan
coz by default all real values are converted to double and it is larger than float.ie real nos are not stored accurately inside computer memory.so since double occupies more memory it prints hi On Fri, Aug 5, 2011 at 8:24 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: the reason is dat 0.7

Re: [algogeeks] MICRSOFT WRITEN TEST

2011-08-05 Thread raj kumar
Ms written test besides objective test you will get three or four subjective questions which happened in our case: so be prepared for UML diagrams: There's high probability that the questions can repeat So do these:(don,t remember exactly b'coz i wasn't eligible to sit so writing the questions

[algogeeks] probablity

2011-08-05 Thread Kamakshii Aggarwal
I was given 3 packets, with 2 pens each. 1st Packet has 2 blue pens. 2nd Packet has 1 blue pen,1 black pen. 3rd Packet has 2 black pens. I took any one packet and pulled out one pen. It turned out to be a blue one. What is the probability that the next pen from the same packet will also

Re: [algogeeks] probablity

2011-08-05 Thread arvind kumar
Jus use Baye's theorem.its a direct n simple app of dat:) On Fri, Aug 5, 2011 at 9:14 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: I was given 3 packets, with 2 pens each. 1st Packet has 2 blue pens. 2nd Packet has 1 blue pen,1 black pen. 3rd Packet has 2 black pens. I took any

Re: [algogeeks] array pointer

2011-08-05 Thread mohit goyal
n=x, is correct or n = x[0][0] is correct On 8/5/11, Arshad Alam alam3...@gmail.com wrote: we can equate base address of double dimension array to a pointer variable, tell me which one is correct. if n is a pointer variable and x[5][5] is double dimension array 1. n=x; 2. n=x[0][0];

Re: [algogeeks] probablity

2011-08-05 Thread Puneet Goyal
1/2 you got the blue pen so it is for sure that is one of the first two packets, so you are left with a black pen and a blue pen and you have to find the probability of finding a blue pen among them On Fri, Aug 5, 2011 at 9:14 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: I was given 3

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread nishaanth
@deepikayour solution is not O(n) i guess... @Sachinthe question says compress the *same* string. By 'printing' i dont know what you mean On Fri, Aug 5, 2011 at 5:17 PM, deepikaanand swinyanand...@gmail.comwrote: static int array[256]; removedupli(char s[],int n) { array[s[0]]=1;

Re: [algogeeks] output???

2011-08-05 Thread Rajesh Kumar
Thanks to all On Fri, Aug 5, 2011 at 8:53 PM, sukran dhawan sukrandha...@gmail.comwrote: coz by default all real values are converted to double and it is larger than float.ie real nos are not stored accurately inside computer memory.so since double occupies more memory it prints hi On Fri,

Re: [algogeeks] probablity

2011-08-05 Thread Rahul Jain
i agree with puneet. 1/2 On Fri, Aug 5, 2011 at 9:18 PM, Puneet Goyal puneetgoya...@gmail.comwrote: 1/2 you got the blue pen so it is for sure that is one of the first two packets, so you are left with a black pen and a blue pen and you have to find the probability of finding a blue pen

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread kartik sachan
@priya its some thing like this for(i=0;a[i]!='\0';i++) count['a[i]']++; so its O(n) only -- 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] probablity

2011-08-05 Thread nishaanth
5/6 On Fri, Aug 5, 2011 at 5:55 PM, Rahul Jain rahuljai...@gmail.com wrote: i agree with puneet. 1/2 On Fri, Aug 5, 2011 at 9:18 PM, Puneet Goyal puneetgoya...@gmail.comwrote: 1/2 you got the blue pen so it is for sure that is one of the first two packets, so you are left with a black

[algogeeks] Re: Printf

2011-08-05 Thread SAMMM
Logical Address ... as Physical address is not accessable tht's wht OS does , it maps the physical address to the logical address . -- 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] probablity

2011-08-05 Thread abhishek iyer
@Nishant.. Can u please explain ur approach.. I think its as per mentioned above 1/2... On 5 Aug 2011 21:30, nishaanth nishaant...@gmail.com wrote: 5/6 On Fri, Aug 5, 2011 at 5:55 PM, Rahul Jain rahuljai...@gmail.com wrote: i agree with puneet. 1/2 On Fri, Aug 5, 2011 at 9:18 PM, Puneet

Re: [algogeeks] array pointer

2011-08-05 Thread nishaanth
1 On Fri, Aug 5, 2011 at 5:47 PM, mohit goyal mohitgoya...@gmail.com wrote: n=x, is correct or n = x[0][0] is correct On 8/5/11, Arshad Alam alam3...@gmail.com wrote: we can equate base address of double dimension array to a pointer variable, tell me which one is correct. if n is a

[algogeeks] Re: MICRSOFT WRITEN TEST

2011-08-05 Thread siva viknesh
ques ll be simple but they expect solid,secure,scalable, and efficent code .. for instance.. they asked merging 2 sorted LL.. .. ppl who forgot to check d simple condition...say .. if(head==NULL)return; were eliminated On Aug 5, 8:28 pm, raj kumar megamonste...@gmail.com

Re: [algogeeks] simple doubt

2011-08-05 Thread nishaanth
i think both are erroneous. first statement i think you are trying to change the array address which is not possible. second statementarr doesn't make any sense i guess arr gives the address but arr is not allowed On Fri, Aug 5, 2011 at 4:19 PM, Vijay Khandar

Re: [algogeeks] simple doubt

2011-08-05 Thread himanshu kansal
i think 1st is wrong bt 2nd is correct.. On Fri, Aug 5, 2011 at 9:51 PM, nishaanth nishaant...@gmail.com wrote: i think both are erroneous. first statement i think you are trying to change the array address which is not possible. second statementarr doesn't make any sense i

[algogeeks] a C question

2011-08-05 Thread snehi jain
#includestdio.h main() { long x; float t; scanf(%f,t); printf(%d\n,t); x=90; printf(%f\n,x); { x=1; printf(%f\n,x); { x=30; printf(%f\n,x); } printf(%f\n,x); } x==9; printf(%f\n,x); getch(); } o/p (when i had given input as 67 this is the output) 0 67.0 67.0 67.0 67.0

Re: [algogeeks] Structure Q

2011-08-05 Thread Jyoti Gupta
it should be head-x=100 ryt??? On 5 August 2011 17:32, Vijay Khandar vijaykhand...@gmail.com wrote: Thanks On Fri, Aug 5, 2011 at 5:25 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: ERROR On Fri, Aug 5, 2011 at 5:19 PM, Vijay Khandar vijaykhand...@gmail.comwrote: struct

Re: [algogeeks] simple doubt

2011-08-05 Thread pankaj kumar
first one is right and second is wrong.because dp will store address of pointer and here you are storing address of int 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@googlegroups.com. To

Re: [algogeeks] Structure Q

2011-08-05 Thread pankaj kumar
head-x=100 is not right if you will first declare head=new list; head-x=100; will be right. -- 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: Duplicates in a string

2011-08-05 Thread hary rathor
#includestring.h int main () { char str[]=hello world; int i,j=0,checker=0; for(i=0;istrlen(str);i++) { int val=str[i]-'a'; if ((checker(1val))=0) str[j++]=str[i]; checker|=(1val); } str[j]='\0'; printf(%s,str); return 0; } -- You received this message because you are subscribed

Re: [algogeeks] Structure Q

2011-08-05 Thread Amol Sharma
yes... it would be error ...to be specific it is segmentation faultyou are trying to access a memory which do not exist -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Fri, Aug 5, 2011 at 10:21 PM, pankaj kumar pancsen...@gmail.com wrote:

[algogeeks] array pointer

2011-08-05 Thread Arshad Alam
we can equate base address of double dimension array to a pointer variable, tell me which one is correct. if n is a pointer variable and x[5][5] is double dimension array 1. n=x; 2. n=x[0][0]; 3. both -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread priya v
@all : Thanks a lot for the solutions! On Fri, Aug 5, 2011 at 10:31 PM, hary rathor harry.rat...@gmail.com wrote: #includestring.h int main () { char str[]=hello world; int i,j=0,checker=0; for(i=0;istrlen(str);i++) { int val=str[i]-'a'; if ((checker(1val))=0)

Re: [algogeeks] array pointer

2011-08-05 Thread Manish Sharma
1 On Fri, Aug 5, 2011 at 10:35 PM, Arshad Alam alam3...@gmail.com wrote: we can equate base address of double dimension array to a pointer variable, tell me which one is correct. if n is a pointer variable and x[5][5] is double dimension array 1. n=x; 2. n=x[0][0]; 3. both

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread pankaj kumar
int b[26]={0}; vectorcharc; for(i=0;a[i];i++) { if(!b[(a[i]-65)]) { b[(a[i]-65)]++; c.push_back(a[i]); } } for(i=0;ic.size();i++) coutc[i]; } -- 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] Makemytrip.com

2011-08-05 Thread parag khanna
half an hour Aptitude test , after that half an hour written test , then Technical rounds (2-3) and then HR profile Software dev - 6 lacs QA - 5 lacs -- 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] Re: Duplicates in a string

2011-08-05 Thread rajul jain
Can You please explain this bit manipualtion On Fri, Aug 5, 2011 at 10:31 PM, hary rathor harry.rat...@gmail.com wrote: #includestring.h int main () { char str[]=hello world; int i,j=0,checker=0; for(i=0;istrlen(str);i++) { int val=str[i]-'a'; if ((checker(1val))=0)

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread pankaj kumar
when you encounter the letter for first time then simply increment array having index=(ASCII value-65) and put that in vector next time when you will encounter the same variable again then condition will fail hence no change in content of vector hence in the end simply print the vector -- You

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread pankaj kumar
coming for which branch?? -- 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 options,

[algogeeks] difference between the two

2011-08-05 Thread priya v
Whats the difference between the two ? 1) struct list { int data; list *next; } and 2) struct list { list *next; int data; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread parag khanna
CS,IT,ECE -- 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 options, visit this

Re: [algogeeks] Re: Duplicates in a string

2011-08-05 Thread hary rathor
i have used 26 bit of checker variable then i have checked in if statemet that if bit is set there then put then character in jth posion, then set the the bit for character -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] simple doubt

2011-08-05 Thread Amol Sharma
both are wrong.run and see that warning will be displayed !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Fri, Aug 5, 2011 at 10:17 PM, pankaj kumar pancsen...@gmail.com wrote: first one is right and second is wrong.because dp will store address

Re: [algogeeks] difference between the two

2011-08-05 Thread hary rathor
no ,if u r using 32 bit machine . that will use 4 byte pointer size , but in 64 machine that enforce to be size of 8 . where padding will take int your given first structure so for 32 bit- size will 8 8 for both structure for 64 bit - size will 16 and 12 respectively cause of 4 bit padding in

Re: [algogeeks] array pointer

2011-08-05 Thread Amol Sharma
1 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Fri, Aug 5, 2011 at 10:37 PM, Manish Sharma manish.manishkumar.shar...@gmail.com wrote: 1 On Fri, Aug 5, 2011 at 10:35 PM, Arshad Alam alam3...@gmail.com wrote: we can equate base address of

[algogeeks] Re: Goldman sachs intern

2011-08-05 Thread Agyat
guys please post the questions On Aug 5, 3:13 pm, arvind kumar arvindk...@gmail.com wrote: NIT ALLAHABAD guys!! Please share your experiences abt Goldman sachs recruitment.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] difference between the two

2011-08-05 Thread priya v
in case of 64 bit machine y doesn't padding happen in the 2nd structure? On Fri, Aug 5, 2011 at 11:21 PM, hary rathor harry.rat...@gmail.com wrote: no ,if u r using 32 bit machine . that will use 4 byte pointer size , but in 64 machine that enforce to be size of 8 . where padding will take

[algogeeks]

2011-08-05 Thread Rajeshwar Patra
mynode* reverse_recurse(mynode *root) { if(root-next!=(mynode *)0) { reverse_recurse(root-next); root-next-next=root; return(root); } else { head=root; } } how does it reverses the singly linked list -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this

Re: [algogeeks] array pointer

2011-08-05 Thread UTKARSH SRIVASTAV
I THINK THIS WILL CLEAR YOUR DOUBT x = address of first element of array=x[0][0] *x=addrss of x[0][0]; **x=x[0][0] x=address of x[0][0]; x[0]=address of x[0][0]; x[1]=address of x[1][0] *x[2]=address of x[2][0]; so 2 is wrong -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3Rd Year @MNNIT ALLAHABAD*

[algogeeks] Re: Circle

2011-08-05 Thread Don
// Draw a circle with center (x,y) and radius r circle(int x, int y, int r) { int a = 0; int b = r; while(a = b) { // Draw the current location in all 4 quadrants plot(x+a, y+b); plot(x-a, y+b); plot(x+a, y-b); plot(x-a, y-b); plot(x+b, y+a); plot(x-b, y+a);

Re: [algogeeks] difference between the two

2011-08-05 Thread UTKARSH SRIVASTAV
I think voth are just same.. On Fri, Aug 5, 2011 at 10:57 AM, priya v pria@gmail.com wrote: in case of 64 bit machine y doesn't padding happen in the 2nd structure? On Fri, Aug 5, 2011 at 11:21 PM, hary rathor harry.rat...@gmail.comwrote: no ,if u r using 32 bit machine

Re: [algogeeks] a C question

2011-08-05 Thread mithun bs
The culprit in this program is printing a float variable with %d specifier. printf(%d\n, t); Removing this line, the program behaves normally. This line may crash your program. Also it may remove some bytes from your stack. I feel this is what happening. Even I am not very convinced. Still

[algogeeks] Re: probablity

2011-08-05 Thread shiv narayan
according to me it is 1/3 read the line carefully What is the probability that the next pen from the same packet will also be a blue one? since it is said the first pen was blue and second pen must also be blue. for it to happen 1st packet contaning all blue pen should be selected whose

Re: [algogeeks] simple doubt

2011-08-05 Thread Aman
1st is right, n when you do pa++, it will jump by size of 1st one-D array(in case array is of more than one dimension), even in this case, it'll jump by the whole array size(6). On 5 August 2011 23:20, Amol Sharma amolsharm...@gmail.com wrote: both are wrong.run and see that warning will be

Re: [algogeeks] Structure Q

2011-08-05 Thread UTKARSH SRIVASTAV
only by declaring head and then doing head.x=100 is wrongbecause head is only apointer that can store address of only a list type of variable...whwn we allocate memmory by malloc or new then you can do head-x=100..and head.x is wrong ...use either

Re: [algogeeks] simple doubt

2011-08-05 Thread Arun Vishwanathan
@nishant : where is the array address getting changed in first one? it just says pa=arr isnt arr address of the pointer to the first element of the array? On Fri, Aug 5, 2011 at 6:21 PM, nishaanth nishaant...@gmail.com wrote: i think both are erroneous. first statement i think you are

Re: [algogeeks] simple doubt

2011-08-05 Thread Arun Vishwanathan
@amol: hmm but I would like to know the reason for it if it is so On Fri, Aug 5, 2011 at 7:50 PM, Amol Sharma amolsharm...@gmail.com wrote: both are wrong.run and see that warning will be displayed !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad

Re: [algogeeks] simple doubt

2011-08-05 Thread UTKARSH SRIVASTAV
int (*pa)[3]; pa is a pointer to an array of 3 elements for example in x[3] to xin z[4][3] to z[0],z[1],z[2],z[3].so pa=arr is correct and ..dp is a pointer that sore address of a pointer so dp=a will give only warning but you can't do **dp in this case

Re: [algogeeks] simple doubt

2011-08-05 Thread Jiten
(*pa)[3] ;// pa is array of pointers to int type; so pa = arr; doesn't make any sense ,bcoz arr represents the base address of it(address of arr[0]). and pa represent the address of pa[0](which hold a pointer). I hope it's clear now --

[algogeeks] Re: Circle

2011-08-05 Thread Dave
@Don: The sequence of points (x+a, y+b) generated by your algorithm moves along the arc of the circle from theta = 90 degrees to theta = 45 degrees. Along this arc, the slope of the curve is -1 = dy/dx = 0. Thus, rather than moving from (x+a, y+b) to either (x+a+1, y+b) or (x+a, y+b-1), you should

Re: [algogeeks] Re: probablity

2011-08-05 Thread Puneet Goyal
@shiv : you are considering the case when you need to know the probability of both pens being blue, but in the question you already know that 1st one is blue so you dont need to care about it, and also the 3rd packet getting eliminated coz of it increases the probability to 1/2 -- You received

Re: [algogeeks] difference between the two

2011-08-05 Thread Kamakshii Aggarwal
in case of 64 bit, size of second structure will also be 16 not 8 On Fri, Aug 5, 2011 at 11:40 PM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: I think voth are just same.. On Fri, Aug 5, 2011 at 10:57 AM, priya v pria@gmail.com wrote: in case of 64 bit machine y

[algogeeks] To reverse a linked list

2011-08-05 Thread Nikhil Gupta
What is the error in the program? I tried to run it on ideone, but its giving runtime error. This is a program to reverse a linked list. #includestdio.h #includemalloc.h int count=0; struct try{ int data; struct try *next; }; typedef struct try node; node *head,*head2; void

[algogeeks] Re: a C question

2011-08-05 Thread vikash
well I don't have explanations but this happens because the floats,ints and longs , they are stored differently in memory. -- 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

[algogeeks] Re: To reverse a linked list

2011-08-05 Thread Nikhil Gupta
Sorry. this program reverses the 1st k nodes of the linked list. Not the entire list. On Sat, Aug 6, 2011 at 12:48 AM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: What is the error in the program? I tried to run it on ideone, but its giving runtime error. This is a program to reverse a

Re: [algogeeks] output???

2011-08-05 Thread sagar pareek
ha ha its not like it stores slightly less than actual :P :P try this float a=0.5,b=1.0,c=0.7; if(0.5==a) printf(yes a=0.5\n); if(1.0==b) printf(yes b=1.0\n); if(0.7!=c) printf(Yes c!=0.7\n); o/p will be yes a=0.5 yes b=1.0 yes c!=0.7 check it out i will explain it later... On Fri, Aug 5,

[algogeeks] Re: output???

2011-08-05 Thread vikash
its due to precision limit of double is larger than float, and by default real values are stored as double so constant 0.7 is stored more accurately(8 bytes) that float a=0.7 (4 bytes). and when comparing the two float is typecasted into double and so the ramaining bits are padded with 0 so 0.7

Re: [algogeeks] Re: output???

2011-08-05 Thread sagar pareek
@vikas first read what i wrote On Sat, Aug 6, 2011 at 12:59 AM, vikash vikash.ckiiit...@gmail.com wrote: its due to precision limit of double is larger than float, and by default real values are stored as double so constant 0.7 is stored more accurately(8 bytes) that float a=0.7 (4 bytes).

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread snehi jain
thanks for the information .. the technical round had MCQs or coding questions ?? On Fri, Aug 5, 2011 at 11:09 PM, parag khanna khanna.para...@gmail.comwrote: CS,IT,ECE -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread parag khanna
both -- 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 options, visit this group at

[algogeeks] Re: To reverse a linked list

2011-08-05 Thread Gene
It's easy if you think in terms of pop and push operations. Pop the first k elements off the head of the list and push them onto a new list. They're now in reverse order. All that's left is to connect the two lists. You can do this efficiently if you keep a pointer to the tail element. NODE

[algogeeks] Re: Samsung Written

2011-08-05 Thread vikash
aptitude test 1 hour quantitative and general reasoning technical round 30 min. then interview On Aug 5, 5:20 pm, parag khanna khanna.para...@gmail.com wrote: Apti 1 hour -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Re: output???

2011-08-05 Thread Piyush Kapoor
I think it is because the numbers like 0.7 do not have a exact binary representation,so they are not exactly represented in float,while the constant is internally implemented as double.,Read this:: http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=integersReals -- *Regards,* *Piyush

[algogeeks] help on string manipulation bit manipulation

2011-08-05 Thread shiv narayan
i have seen plenty of questions on string manipulation and bits operations asked in various comcanies exams. any one give me some good links where i can find some really good tutorials on string manipulation. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Samsung SISO Question

2011-08-05 Thread amit kumar
can u plz xplain d qstn a litl more thanx On Fri, Aug 5, 2011 at 8:33 PM, bagaria.ka...@gmail.com bagaria.ka...@gmail.com wrote: Given a rope of 10m , numbered at 1m i.e like 0 1 2 3 4 5 6 7 8 9 10 ||---|---|---|---|---|---|---|---|---| |---10m|

Re: [algogeeks] Samsung SISO Question

2011-08-05 Thread Ankur Pandey
U can use merge sort for this.. try and picture the problem, u'll get my point.. On Fri, Aug 5, 2011 at 1:27 PM, amit kumar amitthecoo...@gmail.com wrote: can u plz xplain d qstn a litl more thanx On Fri, Aug 5, 2011 at 8:33 PM, bagaria.ka...@gmail.com bagaria.ka...@gmail.com wrote:

Re: [algogeeks] Re: output???

2011-08-05 Thread sagar pareek
yup exactly On Sat, Aug 6, 2011 at 1:51 AM, Piyush Kapoor pkjee2...@gmail.com wrote: I think it is because the numbers like 0.7 do not have a exact binary representation,so they are not exactly represented in float,while the constant is internally implemented as double.,Read this::

Re: [algogeeks] hash table

2011-08-05 Thread mohit verma
yes you can... for randomness , the key value will be key=rand() and now implement your hash function with this key. On Fri, Aug 5, 2011 at 4:53 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: can we implement random() function on a hash table in O(1) . -- Regards, Kamakshi

Re: [algogeeks] Re: output???

2011-08-05 Thread Shashank Jain
sagar - i dint get u, d code thing! Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sat, Aug 6, 2011 at 2:31 AM, sagar pareek sagarpar...@gmail.com wrote: yup exactly On Sat, Aug 6, 2011 at 1:51 AM, Piyush Kapoor pkjee2...@gmail.com wrote: I think it is

Re: [algogeeks] difference between the two

2011-08-05 Thread Shashank Jain
i dont understand the diff btw dem, could u plz elaborate? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Sat, Aug 6, 2011 at 12:32 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: in case of 64 bit, size of second structure will also be 16 not 8 On Fri,

[algogeeks] MS question

2011-08-05 Thread priyanshu
Give an efficient algorithm to determine which part of the video should be displayed as a thumbnail?? -- 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

<    1   2   3   >