[algogeeks] Print Permutaion of a given String

2012-10-01 Thread rahul sharma
-- 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 ht

[algogeeks] Design an OO representation to model HTML.

2012-10-01 Thread ~*~VICKY~*~
Could someone throw some light on this OOPS question. I detailed explanation would be of immense help. Design an OO representation to model HTML. How do they represent tags and content? What about containment relationships? Bonus points if they know that this has already been done a bunch of times

Re: [algogeeks] Re: Given a two dimensional graph with points on it, find a line which passes the most number of points.

2012-10-01 Thread shashi kant
thanks @dave *Shashi Kant * ***"Think positive and find fuel in failure"* *System/Software Engineer* *Hewlett-Packard India Software Operations. * On Mon, Oct 1, 2012 at 10:42 PM, Dave wrote: > @Shashi: It has been discussed before, and an O(n^2 log n) solution is > outlined at > https://gr

[algogeeks] Re: Given a two dimensional graph with points on it, find a line which passes the most number of points.

2012-10-01 Thread Dave
@Shashi: It has been discussed before, and an O(n^2 log n) solution is outlined at https://groups.google.com/d/msg/algogeeks/fBhXY9aUNJ0/CTB_p7uO8YYJ and is given in more detail at https://groups.google.com/d/msg/algogeeks/fBhXY9aUNJ0/0S0zK6HdKdMJ. Dave On Monday, October 1, 2012 12:00:19 PM

[algogeeks] Given a two dimensional graph with points on it, find a line which passes the most number of points.

2012-10-01 Thread shashi kant
Given a two dimensional graph with points on it, find a line which passes the most number of points. Can somebody suggest possible ways to do it. *(or point me to the post if this problem is already discussed)* *Thanks & Regards,* *Shashi Kant * ***"Think positive and find fuel in failure"* htt

Re: [algogeeks] Facebook question!

2012-10-01 Thread saurabh agrawal
Do we need to handle cases when the same string will appear again?? In that case we can sort individual array and remove duplicates. On Mon, Oct 1, 2012 at 9:54 AM, Rahul Singh wrote: > check this out.. > > #include > #include > using namespace std; > > void print_sets(string *s,int pos,int n,ch

Re: [algogeeks] Re: Google Q : all anagrams next to each other

2012-10-01 Thread shashi kant
A solution given below taken from "cracking the Coding interview " book... Solution is create a Comparator and a small change in "compare" method is that u sort the characters of that string and then compare. and just sort the arrays, using this compareTo method instead of the usual one. Arrays.s

[algogeeks] Re: microsoft_c++_qstn

2012-10-01 Thread vikas
not sure what interviewer meant here, does not look like compiler dependent code, and BTW, last recurrence yield "5" :) and not 8, one possible def is, you have a function with no return and compiler is independent for choosing what to return in this case, just a guess. Not sure about cpp stand

Re: [algogeeks] finding element in array with minimum of comparing

2012-10-01 Thread vikas
still there is no improvement, compiler will generate the code to compare with zero here. what you have accomplished is , hide it from human eyes On Monday, 1 October 2012 15:25:09 UTC+5:30, Navin Kumar wrote: > > @atul: > still it won't compare 0 th element. Slight modification in your code: >

Re: [algogeeks] finding element in array with minimum of comparing

2012-10-01 Thread Navin Kumar
@atul: still it won't compare 0 th element. Slight modification in your code: n=*sizeof(arr)*; do { if(elem==arr[*--n*]) print found; }while(n); On Mon, Oct 1, 2012 at 9:50 AM, atul anand wrote: > yes, but there no need of checking outside the loop > > n=sizeof(arr)-1; > do > { >

Re: [algogeeks] Facebook question!

2012-10-01 Thread Rahul Singh
check this out.. #include #include using namespace std; void print_sets(string *s,int pos,int n,char *to_print) { if(pos==n) { return; } for(int i=0;i>n; string s[n]; for(int i=0;i>s[i]; } char *to_print = new char[n]; print_sets(s,0,n,to_print); } --

Re: [algogeeks] Facebook question!

2012-10-01 Thread Rahul Singh
check this out.. #include #include using namespace std; void print_sets(string *s,int pos,int n,char *to_print) { if(pos==n) { return; } for(int i=0;i>n; string s[n]; for(int i=0;i>s[i]; } char *to_print = new char[n]; print_sets(s,0,n,to_print); }