Re: [algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-25 Thread rohit jangid
this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. -- Rohit Jangid http://rohitjangid.com Graduate Deptt. of Computer Engineering NSIT

Re: [algogeeks] Math problem

2013-05-15 Thread rohit jangid
after few attempts I think you must be getting stuck where you need a^3 + b^3 + c^3 value in terms of abc, C1, and C2 which is possible using this identity-- (a+b+c)³=(a³+b³+c³)+3[(a+b+c)(ab+ac+bc)-abc] refer this link for the proof

Re: [algogeeks] clearing n-stages of a game.

2013-05-04 Thread rohit jangid
a very standard dp problem . try to formulate recurrence relation . it has been mentioned a couple of times on stackoverflow as well . On May 5, 2013 8:28 AM, sreekanth guru sreekanth.i...@gmail.com wrote: There n stages of a game. At each stage i you will come across a devil. Each devil has

Re: [algogeeks] Re: Amazon Interview Questions

2013-03-12 Thread rohit jangid
. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Rohit Jangid Graduate Deptt. of Computer Engineering NSIT, Delhi University, India -- You

Re: [algogeeks] help with o/p why 0 comes???

2013-03-04 Thread rohit jangid
Sandeep s.shubhamsand...@gmail.comwrote: on my system every time o/p is 0 using ubuntu 10.04 ,gcc compiler On Mon, Mar 4, 2013 at 7:34 AM, rohit jangid rohit.nsi...@gmail.comwrote: output for me for the previous snippet localhost:slingshot rohitjangid$ ./a.out 1799476872 1799474584

Re: [algogeeks] Re: Algo Question

2013-03-03 Thread rohit jangid
are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Rohit Jangid Graduate Deptt. of Computer

Re: [algogeeks] help with o/p why 0 comes???

2013-03-03 Thread rohit jangid
to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Rohit Jangid Graduate Deptt. of Computer Engineering NSIT, Delhi University, India -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] help with o/p why 0 comes???

2013-03-03 Thread rohit jangid
On Mon, Mar 4, 2013 at 7:33 AM, rohit jangid rohit.nsi...@gmail.com wrote: yeah true . one interesting thing I noticed is that if you run this code #includestdio.h int main() { int i = 0; do { printf (%d\n,(float)1); }while(i++ 1); return 0; } one would expect same

Re: [algogeeks] need help??

2012-09-22 Thread Rohit Singhal
group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Singhal 09211931609 -- You received

Re: [algogeeks] JAVA PROGRAM ERROR

2012-08-21 Thread Rohit Singhal
Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Singhal 09211931609 -- You

Re: [algogeeks] A logical Question

2011-10-29 Thread Rohit Srivastava
remains same On Sat, Oct 29, 2011 at 12:21 PM, praveen raj praveen0...@gmail.com wrote: amount displaced by (boat +man + suitcase) = amount displaced by (boat+man) + amount displaced by suitcase therefore no change of level... With regards, Praveen Raj DCE-IT 3rd yr 735993

[algogeeks] Sapient Help!!

2011-09-28 Thread rohit
Is anybody know about sapient working culture? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks]

2011-09-25 Thread Rohit Upadhyaya
thanks every1 for their explanations especially vishwaas and anup ghatage -- 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]

2011-09-22 Thread Rohit Upadhyaya
int main() { int a=256; char *p=a; *++p=2; printf(%d,a); return(0); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks]

2011-09-22 Thread rohit jangid
isn't that simply because if little indian endian way of storing bytes in memory initial -- 0001 0.. finally-- 0010 0.. On Sep 22, 2011 5:38 PM, Rohit Upadhyaya mailtoroh...@gmail.com wrote: int main() { int a=256; char *p=a; *++p=2; printf(%d

Re: [algogeeks] plz help

2011-09-22 Thread rohit jangid
got 45 on linux than tried with fflush(stdout) and got 9 which is correct . so I guess that both child and parent process getting the same buffer and thus resulting in more number of hello correct answer is 9 as already mentioned On Sep 21, 2011 7:57 PM, sush57 sushaant...@gmail.com wrote:

Re: [algogeeks] Re: Interview Questions

2011-09-15 Thread Rohit Upadhyaya
Try This 1-: #includestdio.h #includestdlib.h int main() { int w=10; int *p=w; int *x; x=(int *)malloc(sizeof(int)*1); *x=1000; int *y; y=(int *)malloc(sizeof(int)); *y=100; printf(%d %d %d,*x,*p,*y); return 0; } -- You received this message because you are subscribed to the Google

Re: [algogeeks] what is the output????

2011-09-14 Thread Rohit Upadhyaya
can any1 explain me the fork() function??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] C output

2011-09-14 Thread Rohit Upadhyaya
for a 32 bit it is 4 ,3 and for 16 bit it is 2,3 and 64 bit it is 8,3.. also strlen(d) gives 3 bcz the coding of fn strlen() is such that as it encounters null it will terminate..so irrespective of machine it prints 3 as null at 4th place -- You received this message because you are subscribed

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
=temp l++; r--; } } Thanks Regards, -Rohit On Sat, Sep 10, 2011 at 5:24 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: swap k elements form 1 to k and n-k to n respectively... ex: k=3 temp=k; int a[9]= {9,7,6,5,3,23,14,2,4} ; has become

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
This can also be done: for( i=0; ik;i++) { b[i]=a[i]; } for (;in;i++) { a[i-k]=a[i]; } while((i-k)n) { a[i-k]=b[i]; } But extra array is used here. On Sat, Sep 10, 2011 at 5:30 PM, Rohit jalan jalanha...@gmail.com wrote: How is this one ?? int a[9]={9,7,6,5,3,23,14,2,4} n=9

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
@BharathKumar: extremely sorry dude .. will not do this again .. Can you forgive me ? :p On Sep 10, 2011 12:09 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: @rohit : why don't u have a look at the older posts before replying some thing ...ok .. I'm sorry if u are hurt .. what

Re: [algogeeks] logical and physical address

2011-09-10 Thread rohit kumar
please explain ... On Sat, Sep 10, 2011 at 5:10 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: physical address:19 bits(10+9) logical address : 15 bits(6+9) On Sat, Sep 10, 2011 at 6:48 AM, ravi maggon maggonr...@gmail.com wrote: we have page table having 64 entries of 10

[algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
How to find out Kth largest element in an array ? -- Thanks Regards : ROHIT JALAN -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email

Re: [algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
@Brijesh: Can you help me with a code ? or atleast pseudo code ? How are you going to keep on inserting the elements ? Thanks Regards, -Rohit On Thu, Sep 8, 2011 at 10:38 PM, Brijesh brijeshupadhyay...@gmail.comwrote: make a max heap of size K , and keep inserting all the elements

Re: [algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
http://www.personal.kent.edu/%7Ermuhamma/Algorithms/MyAlgorithms/Sorting/heapSort.htmfor MH b) Else ignore it. O((n-k)*logk) 3) Finally, MH has k largest elements and root of the MH is the kth largest element. Thanks Regards, -Rohit On Thu, Sep 8, 2011 at 11:20 PM, praveen raj praveen0

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread ROHIT SINGHAL
. -- Regards: Rohit Singhal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread ROHIT SINGHAL
of the initial failure in the placements(ended up where i did not planed). I wish that wont happen with anybody. Thank you, Sid. On Tue, Sep 6, 2011 at 2:19 PM, rahul vatsa vatsa.ra...@gmail.comwrote: :D may be u lost this to gt something better :-) On Tue, Sep 6, 2011 at 4:32 AM, ROHIT SINGHAL

[algogeeks] memory allocation question

2011-09-03 Thread rohit
how many bytes are allocated by following code? #includealloc.h #define col 4 #define row 3 int main() { int(*p)[col]; p=(int(*)[col])malloc(row*sizeof(*p)); return 0; } please explain answer? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Amazon - Coding Round-2 Qn

2011-08-31 Thread rohit
Q1. NODE* head //points to the bst(if it exists) void exist_bst(NODE *tree) { if(tree != NULL) { if(tree-left-info tree-info tree-right-info = tree-info) { if(check(tree)) head = tree; } else { exist_bst(tree-left); exist_bst(tree-right); } }

[algogeeks] Re: Static variable

2011-08-31 Thread rohit
123456789 -- 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/-/OsL6-Vp91qoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from

Re: [algogeeks] Re: Static variable

2011-08-31 Thread rohit
None of us is right https://ideone.com/KBVuM -- 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/-/mar0GJWGi5kJ. To post to this group, send email to

Re: [algogeeks] Re: Static variable

2011-08-31 Thread rohit
while(--i 0) //suppose i = 1 here, so --i becomes 0, hence the condition fails...so it will go 1 step back in recursion { main(); printf(%d,i); } it will execute printf(%d,i) of prev recursion where i=0 now, so 0 gets printed...now again the condition is checked i=0, thrfore --i becomes -1,

[algogeeks] Re: Static variable

2011-08-31 Thread rohit
+1 to chris -- 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/-/fzTBEIWLGcAJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

[algogeeks] Static variable memory location

2011-08-31 Thread rohit
Where does a static variable get allocated in memory..? Like automatic variables get stack, objects allocated through malloc/calloc get memory from heap...wt abt static variable? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

Re: [algogeeks] Re: fork()

2011-08-31 Thread rohit
Someone please provide the recursion tree for it..thanks -- 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/-/_o5nQen8VmAJ. To post to this group, send email to

Re: [algogeeks] Re: loop in link list

2011-08-31 Thread Rohit jalan
: ROHIT JALAN B.E. Graduate, Computer Science Department, RVCE, Bangalore -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks

Re: [algogeeks] informatica

2011-08-29 Thread rohit
Someone please share their recruitment procedure and the topics they focus on.. -- 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/-/nJZwHH_s2j4J. To post to

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

2011-08-28 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

[algogeeks] C doubt

2011-08-28 Thread rohit
Why does the following code not give an error? #includestdio.h void fun(char *a) //array decays to pointer here { a[0] = 'a'; printf(%s\n,a); } int main() { char p[]=hello; fun(p); getch(); } if i write something like this in main char *arr=hello arr[0] = 'r';

Re: [algogeeks] C doubt

2011-08-28 Thread rohit
Thanks for your reply himanshu, ...I am aware of the above stated fact but my doubt is that when i pass this char array to a function and accept it as a char pointer (char *a), and then when write a[0] = 'a', why don't i get an error? -- You received this message because you are subscribed to

Re: [algogeeks] Que of Tejas Network

2011-08-28 Thread rohit
@kamakshi: your algo is wrong Take the test case as {4,3,2,5,8,7} op should be 16 (4,5,7) but ur op = 15 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[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;i16;i++) printf(%d\n,(numi115)?1:0); } please explain -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] elitmus test

2011-08-26 Thread ROHIT SINGHAL
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards: Rohit Singhal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com

[algogeeks] Tejas Network Placement Process!!!

2011-08-26 Thread rohit
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, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Elitmus test Help

2011-08-24 Thread rohit
Is anybody have any idea about pattern of elitmus test , Is It a C programming test or General aptitude test? -- 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

[algogeeks] Tree quuestion

2011-08-24 Thread rohit
How to find the distance of a node from the root of the tree?? Give 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/-/hL50R3KOgGgJ. To post to this

Re: [algogeeks] elitmus test

2011-08-24 Thread ROHIT SINGHAL
this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards: Rohit Singhal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email

Re: [algogeeks] Elitmus test Help

2011-08-24 Thread ROHIT SINGHAL
at 11:45 PM, rohit rajuljain...@gmail.com wrote: Is anybody have any idea about pattern of elitmus test , Is It a C programming test or General aptitude test? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Loop in a linked list

2011-08-24 Thread rohit
Most commonly used algo to detect a loop in a linked list is to have two pointers running, one at double the speed of other and check if they meet..What is the time complexity of this algorithm? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: Syllogism

2011-08-22 Thread Rohit Srivastava
no some girls may not be beautiful or all of them may be beautiful based on your premise the conclusion is incorrect since you havent spoken about the rest of the girls so you dont know nething about them On Mon, Aug 22, 2011 at 1:12 PM, Apoorve Mohan apoorvemo...@gmail.comwrote: U cannot say

[algogeeks] C output

2011-08-22 Thread rohit
#includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] GSOC

2011-08-20 Thread rohit jangid
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Ebay Recruitment

2011-08-18 Thread ROHIT SINGHAL
Guys i m going to appear for ebay any question set or any kinda help for the same -- Regards: Rohit Singhal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from

Re: [algogeeks] Ebay Recruitment

2011-08-18 Thread ROHIT SINGHAL
ebay job location- chennai On Thu, Aug 18, 2011 at 11:28 PM, Swathi chukka.swa...@gmail.com wrote: Is it ebay or paypal? Job location? On Thu, Aug 18, 2011 at 11:26 PM, ROHIT SINGHAL rohitksingha...@gmail.com wrote: Guys i m going to appear for ebay any question set or any kinda help

Re: [algogeeks] Ebay Recruitment

2011-08-18 Thread ROHIT SINGHAL
@siva thanks bro for info. @rahul thru Amcat so its offcampus tey given call to specific students On Fri, Aug 19, 2011 at 1:12 AM, Rahul Tiwari rahultiwari6...@gmail.comwrote: @rohit singhal off-campus or on-campus ? if on-campus ---mention ur college plz -- Rahul Tiwari aka

Re: [algogeeks] Re: Number theory

2011-08-17 Thread Rohit Srivastava
+1 to nitin On Wed, Aug 17, 2011 at 2:48 PM, Vijay Kansal vijaykans...@gmail.comwrote: my bad 2^(n-1)... On Aug 17, 2:17 pm, Vijay Kansal vijaykans...@gmail.com wrote: @nitin it must be 2^n i think On Aug 17, 3:48 am, Bharat Kul Ratan bharat.kra...@gmail.com wrote: It

Re: [algogeeks] GS apti ques!

2011-08-17 Thread Rohit Srivastava
0.788 On Wed, Aug 17, 2011 at 5:23 PM, priya ramesh love.for.programm...@gmail.com wrote: A mistake from my side as well! Got 78.8% :) -- 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] De shaw ques!

2011-08-17 Thread Rohit Srivastava
+1 to nitin On Wed, Aug 17, 2011 at 6:02 PM, Romil ... vamosro...@gmail.com wrote: People this is not the way to approach this one. This question seems to be unfair. Take the number to be 1939 which also leaves 69 as the remainder when divided by 935 but when it is divided by 38, the

[algogeeks] Re: Algorithms For Interviews

2011-08-17 Thread rohit kumra
Please mail it to me also!! On Aug 17, 2:22 pm, Sanjay Rajpal srn...@gmail.com wrote: @Raman : mail kar de bhai abhi. Sanjay Kumar B.Tech Final Year Department of Computer Engineering National Institute of Technology Kurukshetra Kurukshetra - 136119 Haryana, India On Wed, Aug 17, 2011

Re: [algogeeks] an amazing amazon question!

2011-08-17 Thread Rohit Srivastava
logic plz? On Wed, Aug 17, 2011 at 10:35 PM, sagar pareek sagarpar...@gmail.comwrote: 16, 61, 106 average speed is 45 miles/hour On Wed, Aug 17, 2011 at 10:28 PM, priya ramesh love.for.programm...@gmail.com wrote: A car is traveling at a uniform speed.The driver sees a milestone showing

Re: [algogeeks] Re: an amazing amazon question!

2011-08-17 Thread rohit
No third time he just say same digit are appearing but you write interchanging . correct me if i am wrong! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[algogeeks] C output

2011-08-16 Thread rohit
#includestdio.hconst char *fun(); int main() { char *ptr = fun(); return 0; }const char *fun() { return Hello; } Why doesn't this code give error?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the

[algogeeks] Non recursive preorder and postorder

2011-08-15 Thread rohit
Can anyone give algorithm for non recursive preorder and postorder?? -- 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/-/CMDjAwgewoYJ. To post to this group,

[algogeeks] How to hash Strings

2011-08-14 Thread rohit
I came accross a problem where i need to hash strings.. What is the best way to hash strings?? -- 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/-/LlcN35L2Su8J.

Re: [algogeeks] Re: How to hash Strings

2011-08-14 Thread rohit
Well I came across a great hashing algorithm, known as djb2 hash for hashing strings..would like to share it: int get_hash(char *s) { int hash = 0; while(c = *s++) { hash = ((hash 5) + hash) ^ c; } return hash; } this can be done for each individual string to be hashed.. -- You received

Re: [algogeeks] String Question

2011-08-14 Thread rohit
Nice one.. -- 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/-/ShfCI3o9YY0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from

Re: [algogeeks] Re: Jumping Puzzle

2011-08-13 Thread rohit jangid
@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India

Re: [algogeeks] String Doubt

2011-08-13 Thread Rohit Srivastava
2. On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote: Which of the following statements are correct about the below declarations? *char *p = Sanjay; char a[] = Sanjay;*1:There is no difference in the declarations and both serve the same purpose.2:*p* is a non-const pointer

Re: [algogeeks] String Doubt

2011-08-13 Thread Rohit Srivastava
also 3,4 On Sat, Aug 13, 2011 at 7:30 PM, Rohit Srivastava access2ro...@gmail.comwrote: 2. On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote: Which of the following statements are correct about the below declarations? *char *p = Sanjay; char a[] = Sanjay;* 1

Re: [algogeeks] String Doubt

2011-08-13 Thread Rohit Srivastava
my bad only 3,4 On Sat, Aug 13, 2011 at 7:41 PM, rajeev bharshetty rajeevr...@gmail.comwrote: 3,4 On Sat, Aug 13, 2011 at 7:39 PM, Raman raman.u...@gmail.com wrote: In statement 2, isn't p pointing to const string, as we cannot modify the characters of the string. -- You received this

Re: [algogeeks] Re: Jumping Puzzle

2011-08-13 Thread rohit jangid
I can only say that above code is wrong, check this code of mine, I have tested more cases and all are working, https://ideone.com/pEBs8 see if you can find any bug in this one . thanks. On Sat, Aug 13, 2011 at 8:03 PM, WgpShashank shashank7andr...@gmail.com wrote: @rohit , I think we will get

Re: [algogeeks] Re: Jumping Puzzle

2011-08-13 Thread rohit jangid
ok check this, https://ideone.com/hZboG there may be bugs in coding, but I'm quite sure that algo is correct need to check more cases though but working on all the cases discussed here is there any proof that greedy won't work in this case? On Sat, Aug 13, 2011 at 11:03 PM, rohit jangid rohit.nsi

[algogeeks] c output doubt

2011-08-12 Thread rohit
int main() { int a[5]={1,2,3,4,5}; printf(%d,a[4]-a[0]) } why it show 4 not 16? -- 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] Re: c output doubt

2011-08-12 Thread rohit
in memory. Similarly,pointer subtraction will give the difference in indexes and not the memory addresses. If you try subtracting an integer pointer and a float pointer, it will be an error. On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote: int main() { int a[5

Re: [algogeeks]

2011-08-11 Thread rohit jangid
at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

[algogeeks] c output

2011-08-10 Thread rohit
main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(“%d,%d”,m,n); } ans:-m=2,n=3 why output is this??? -- 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

[algogeeks] output help

2011-08-09 Thread Rohit Srivastava
#includestdio.h #includeconio.h int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit={1,2,2}; printf(%d %d %d\n,bit.bit1,bit.bit3,bit.bit4); getche(); return 0; } the above code gives output : -1 2 2 any idea why??? -- You

Re: [algogeeks] output help

2011-08-09 Thread Rohit Srivastava
, output will be -2 2) unsigned int bit3:2, output will be 2. I hope it is cleared now On 8/9/11, Rohit Srivastava access2ro...@gmail.com wrote: #includestdio.h #includeconio.h int main() { struct value { int bit1:1; int bit3:4; int bit4:4

Re: [algogeeks] Doubts

2011-08-09 Thread Rohit Srivastava
@aditi did they mention any thing about miss penalty also in the question ?? On Tue, Aug 9, 2011 at 11:48 AM, aditi garg aditi.garg.6...@gmail.comwrote: @aditya and dipankar: the ans given ws 500ns that is why i posted dis ques...i ws getting the same ans... On Tue, Aug 9, 2011 at 9:45 AM,

Re: [algogeeks] Doubts

2011-08-09 Thread Rohit Srivastava
, Rohit Srivastava access2ro...@gmail.comwrote: @aditi did they mention any thing about miss penalty also in the question ?? On Tue, Aug 9, 2011 at 11:48 AM, aditi gayrg aditi.garg.6...@gmail.comwrote: @aditya and dipankar: the ans given ws 500ns that is why i posted dis ques...i ws

[algogeeks] Re: Doubts

2011-08-09 Thread rohit jain
@aditi For the first question. The answer will be ((0.97 *2) + (0.03*2) +(0.03*100)) i.e 5 ns. The reason is that cache is accessed in the case of miss as well, so we need to include that time as well. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] problem regarding output??

2011-08-09 Thread Rohit Srivastava
typecast only temporarily changes the pointer type of LHS but cannot change that of RHS or even LHS permanently On Tue, Aug 9, 2011 at 5:36 PM, ankit sambyal ankitsamb...@gmail.comwrote: The typecasting tells the compiler that the void pointer is now pointing to an integer and when we use this

[algogeeks] Re: Doubts

2011-08-09 Thread rohit jain
In memory heirachy, whenever some data is to be read, first data is to be searched in M1, if the data is found in M1 then system returns the value from there and counted as a hit. If the value is not found in M1 i.e. Miss for M1 then it accesses M2 and returns the value from there. Since nothing

Re: [algogeeks] Re: Doubts

2011-08-09 Thread Rohit Srivastava
@aditi since in the hierarchy m1 comes first so if it is a hit then we dont need to check m2 but in case of a miss 0.03*2 seconds are wasted while searching in m1 then that value is looked for in m2 so i suppose the best answer is given by rohit jain. unless there is some missing data On Tue, Aug

Re: [algogeeks] MS question

2011-08-09 Thread Rohit Srivastava
google on RLE (run length encoding) its almost similar!! On Tue, Aug 9, 2011 at 6:46 PM, ankit sambyal ankitsamb...@gmail.comwrote: @raghavan: ur approach uses O(n) space -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
it will give error in line 3 because nodeptr is undefined till that point.. On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com wrote: -- 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] c question!

2011-08-09 Thread Rohit Srivastava
yep it will !! any ways nodeptr is another name for pointer to the same structure so you dont need to write structname *nodeptr you can simply write nodeptr *p(say) to declare pointer to the structure On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com wrote: it will give error

Re: [algogeeks] c question!

2011-08-09 Thread Rohit Srivastava
dont use *h just use h On Tue, Aug 9, 2011 at 8:31 PM, siddharth srivastava akssps...@gmail.comwrote: Hi On 9 August 2011 20:26, programming love love.for.programm...@gmail.comwrote: #includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr *h;h-a=programming;printf(hi %s\n,

Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
will nodeptr stand for? On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com wrote: it will give error in line 3 because nodeptr is undefined till that point.. On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com wrote: -- You received this message because you

Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
when you declared h it contains garbage address . h-a is meaningless . read pointers chapter from K nd R for full details about pointers in C . On Aug 9, 2011 9:11 PM, programming love love.for.programm...@gmail.com wrote: #includestdio.htypedef struct {char * a; }*nodeptr; main(){nodeptr

[algogeeks] amazon test question!!!

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

Re: [algogeeks] Javascript

2011-08-08 Thread rohit jangid
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] what is complexity of func(p)

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

Re: [algogeeks] Javascript

2011-08-08 Thread rohit jangid
...@gmail.com wrote: Well actually there are about 1000 values to be stored, but the value itself is small(url of a website..).. i think it should not be a major bottleneck.. Thanks, Priyanshu On Mon, Aug 8, 2011 at 2:39 PM, rohit jangid rohit.nsi...@gmail.com wrote: javaScript's array are just

[algogeeks] Re: n-ary tree

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

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] Question

2011-08-05 Thread Rohit Srivastava
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 Dipankar will solve ur problem if u r

Re: [algogeeks] merging of two sorted arrays

2011-08-04 Thread Rohit jalan
/algogeeks?hl=en. -- Regards : ROHIT JALAN B.E. Graduate, Computer Science Department, RVCE, Bangalore -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group

  1   2   3   4   >