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
T if any good approach some one is having other than this ? > > > -- > You received 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.

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 http://math.stackexchange.com/questions/288965/show-that-abc-a-b

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" wrote: > There n stages of a game. At each stage i you will come across a devil. > Each devil has its own energy E(i) and

Re: [algogeeks] Re: Amazon Interview Questions

2013-03-12 Thread rohit jangid
then traverse till m elements and repeat.* >>>> >>>> *Write production quality code.* >>>> >>>> * >>>> * >>>> >>>> *g. An array of elements have been given. Find for each element, first >>>> max element

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

2013-03-04 Thread rohit jangid
ubham Sandeep wrote: > 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 wrote: > >> output for me for the previous snippet >> >> localhost:slingshot rohitjangid$ ./a.out >> 1799476872 &

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

2013-03-03 Thread rohit jangid
Mon, Mar 4, 2013 at 7:33 AM, rohit jangid wrote: > yeah true . one interesting thing I noticed is that if you run this code > > #include > int main() > { > int i = 0; > do { > printf ("%d\n",(float)1); > }while(i++ < 1); > return

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

2013-03-03 Thread rohit jangid
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 received this message because y

Re: [algogeeks] Re: Algo Question

2013-03-03 Thread rohit jangid
gt;B-Tech. Comp. Science and Engg. > >IIT ROORKEE > > -- > You received 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 alg

Re: [algogeeks] need help??

2012-09-22 Thread Rohit Singhal
ks" 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

Re: [algogeeks] JAVA PROGRAM ERROR

2012-08-21 Thread Rohit Singhal
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@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googl

Re: [algogeeks] Re: algo qstn

2012-01-18 Thread Rohit Srivastava
@ jaimedp: logic? On Wed, Jan 18, 2012 at 4:11 AM, Don wrote: > +1 Jaimedp > > On Jan 17, 1:05 pm, jaimedp wrote: > > 120 > > > > On Jan 17, 5:59 am, Umer Farooq wrote: > > > > > > > > > 0 > > > > > On 1/16/12, Ravi Ranjan wrote: > > > > > > An ant moves on a regular grid of squares that are

Re: [algogeeks] A logical Question

2011-10-29 Thread Rohit Srivastava
remains same On Sat, Oct 29, 2011 at 12:21 PM, praveen raj 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 > praveen0...@gmail

[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 algogeeks+unsubscr...@googlegroups.

Re: [algogeeks]

2011-09-24 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 algo

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" wrote: > main() > { > int tmp; >

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" wrote: > > int main() > { > int a=256; > char *p=&a; >

[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 algogeeks

Re: [algogeeks] Re: Interview Questions

2011-09-15 Thread Rohit Upadhyaya
#include 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 Groups "Algorithm Geeks" group. To pos

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 to

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] 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 wrote: > >> we have page table having 64 entries of 10 bits each. and

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" 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 .. > wh

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
p;a[n-1] > ReverseArray(p,q) > > void ReverseArray(int *l,int *r) > { > int temp; > while(l { > temp=*l; > *l=*r; > *r=temp > l++; > r--; > } > } > > > Thanks & Regards, > -Rohit > > > On

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
quot; 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.g

Re: [algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
<http://www.personal.kent.edu/%7Ermuhamma/Algorithms/MyAlgorithms/Sorting/heapSort.htm>for 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

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 wrote: > make a max heap of size K , and keep inserting all the elements in it.. and > at last the

[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 gro

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread ROHIT SINGHAL
>> I didnt prepare because 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 wrote: >> >>&

Re: [algogeeks] DE shaw question- urgent

2011-09-06 Thread ROHIT SINGHAL
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. > -- Regards: Rohit Singhal -- You

[algogeeks] memory allocation question

2011-09-03 Thread rohit
how many bytes are allocated by following code? #include #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" group. To p

Re: [algogeeks] Re: loop in link list

2011-08-31 Thread Rohit jalan
t go around in circles 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 email to > algogeeks+unsubs

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

[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

[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 fr

[algogeeks] C output

2011-08-31 Thread rohit
output?? int main() { char *d = "abc\0def\0"; printf("%d %d",sizeof(d),strlen(d)); getch(); } -- 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/-/nf_M_

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 -

Re: [algogeeks] Re: Static variable

2011-08-31 Thread rohit
Can anyone explain this? -- 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/-/TQBK-5m3XPgJ. To post to this group, send email to algogeeks@googlegroups.com. To u

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 algogeeks@g

[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] Amazon - Coding Round-2 Qn

2011-08-31 Thread rohit
@aditya: Thanks for pointing out my mistake -- 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/-/QPBpWzBcYQwJ. To post to this group, send email to algogeeks@go

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

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 th

Re: [algogeeks] String Reverse

2011-08-29 Thread rohit agarwal
Print the last character of a string and call the function recursively with remaining string (of length (n-1)) -- * Thanks and Regards* ┌─┐ Rohit Agarwal Final Year B.Tech (Information Technology) NIT Durgapur <http://www.nitdgp.ac

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 https://groups.google.com/d/msg/algogeeks/-/

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

[algogeeks] C doubt

2011-08-28 Thread rohit
Why does the following code not give an error? #include 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'; //this

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

2011-08-27 Thread rohit
How to save a binary search tree space efficiently and built it again , just tell any idea. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

[algogeeks] c program explain

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

[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

Re: [algogeeks] elitmus test

2011-08-25 Thread ROHIT SINGHAL
thm 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. > --

[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" grou

Re: [algogeeks] Elitmus test Help

2011-08-24 Thread ROHIT SINGHAL
l questions >> are asked.. >> >> >> On Wed, Aug 24, 2011 at 11:50 PM, Akanksha . wrote: >> >>> It is a general aptitude test.. they ask u ques on quant, verbel n >>> problems solving skills.. prepare well if u r planning to take this >>> test a

Re: [algogeeks] elitmus test

2011-08-24 Thread ROHIT SINGHAL
> 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@g

[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

[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] C output

2011-08-22 Thread rohit
#include #define max(a,b) (a>b?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, sen

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 wrote: > U cannot say that conclusion is true

[algogeeks] SuccessFactors

2011-08-20 Thread rohit
Does any1 here have ant idea about the recruitment procedure of SuccessFactor ??The questions they ask in written and interview -- 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.c

Re: [algogeeks] GSOC

2011-08-20 Thread rohit jangid
gogeeks+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 -- You received this message because you are subscrib

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 wrote: > @rohit singhal > off-campus or on-campus ? > if on-campus ---mention ur college plz > > > > > > > -- > Ra

Re: [algogeeks] Ebay Recruitment

2011-08-18 Thread ROHIT SINGHAL
ebay job location- chennai On Thu, Aug 18, 2011 at 11:28 PM, Swathi wrote: > Is it ebay or paypal? Job location? > > On Thu, Aug 18, 2011 at 11:26 PM, ROHIT SINGHAL > wrote: > >> Guys i m going to appear for ebay any question set or any kinda help for >> the same &g

[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 u

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 https://groups.google.com/d/msg/algogeeks/-/

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 wrote: > 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 >> a 2-digi

[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 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 at 2:20

Re: [algogeeks] De shaw ques!

2011-08-17 Thread Rohit Srivastava
+1 to nitin On Wed, Aug 17, 2011 at 6:02 PM, Romil ... 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 remainder is only 1. >

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 algog

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 wrote: > my bad 2^(n-1)... > > On Aug 17, 2:17 pm, Vijay Kansal wrote: > > @nitin it must be 2^n i think > > > > On Aug 17, 3:48 am, Bharat Kul Ratan wrote: > > > > > > > > > > > > > > > > > It might be useful: > http://www.artofproblems

[algogeeks] C output

2011-08-16 Thread rohit
#includeconst 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 web

[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, se

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 fro

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 th

[algogeeks] Good Trie theory

2011-08-14 Thread rohit
Is anybody know good links for trie description and their usage? -- 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+unsubsc

[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: 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 jan

Re: [algogeeks] Re: Jumping Puzzle

2011-08-13 Thread rohit jangid
found some bugs , will repost it On Sat, Aug 13, 2011 at 10:55 PM, rohit jangid wrote: > 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 . > &

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 wrote: > @rohit , I think we will get some cases where gre

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 wrote: > 3,4 > > > On Sat, Aug 13, 2011 at 7:39 PM, Raman wrote: > >> In statement 2, isn't p pointing to const string, as we cannot modify the >> characters of the string. >> >> -- >> You received this message because you are su

Re: [algogeeks] String Doubt

2011-08-13 Thread Rohit Srivastava
also 3,4 On Sat, Aug 13, 2011 at 7:30 PM, Rohit Srivastava wrote: > 2. > > > On Sat, Aug 13, 2011 at 7:24 PM, Raman wrote: > >> Which of the following statements are correct about the below >> declarations? >> *char *p = "Sanjay"; >> char

Re: [algogeeks] String Doubt

2011-08-13 Thread Rohit Srivastava
2. On Sat, Aug 13, 2011 at 7:24 PM, Raman 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 pointing to a >

Re: [algogeeks] Re: Jumping Puzzle

2011-08-13 Thread rohit jangid
e Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/37L_lAEKGVkJ. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...

[algogeeks] Re: c output doubt

2011-08-11 Thread rohit
next address > 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 A

[algogeeks] c output doubt

2011-08-11 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 t

Re: [algogeeks]

2011-08-11 Thread rohit jangid
be 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. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" gro

[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

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" wrote: > #includetypedef struct {char * a; > }*nodeptr; > main(){nodeptr h;h->a="programming";printf("hi %

Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
for? > > On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid 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: >> -

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 wrote: > Hi > > On 9 August 2011 20:26, programming love > wrote: > >> #includetypedef struct {char * a; >> }*nodeptr; >> main(){nodeptr *h;h->a="programming";printf("hi %s\n", h->a);} >> >> >> this gives an error. Ple

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 struct *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 wrote: > it will give error in line 3 because node

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" wrote: -- 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. T

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 wrote: > @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 group, send email

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

[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. then it accesses M2 and returns the value from there. Since nothing is given abo

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 wrote: > The typecasting tells the compiler that the void pointer is now pointing to > an integer and when we use this pointer to access th

[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] Doubts

2011-08-09 Thread Rohit Srivastava
yup !!! it will increase the avg access time On Tue, Aug 9, 2011 at 1:39 PM, aditi garg wrote: > @Rohit:No...i directly copy pasted the ques...nothing else mentioned...and > what if thr ws sm miss penalty?what wud be the change in soution? > > > On Tue, Aug 9, 2011 at 1:37 PM, R

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 wrote: > @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, ankit sambyal wrote:

Re: [algogeeks] output help

2011-08-09 Thread Rohit Srivastava
will be -2 > 2) unsigned int bit3:2, output will be 2. > > I hope it is cleared now > > On 8/9/11, Rohit Srivastava wrote: > > #include > > #include > > > > int main() > > { > > struct value > > { > > int bit1:1; > &

[algogeeks] output help

2011-08-08 Thread Rohit Srivastava
#include #include 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 received this messag

Re: [algogeeks] Javascript

2011-08-08 Thread rohit jangid
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 wrote: > >> javaScript&#x

  1   2   3   4   >