Re: [algogeeks] Re: meaning of null in output

2011-07-05 Thread Anurag atri
#include int main () { int * p = NULL ; printf ( "%s" , p ) ; getchar () ; } On Sat, Jul 2, 2011 at 3:33 AM, hary rathor wrote: > Rajeev : please can u explain by a c example ? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" gr

Re: [algogeeks] Sort - Consecutive Array in O(n)

2011-07-05 Thread Anantha Krishnan
Check this *int isconsecutive(int a[], int n) {* *if (n < 1) {* *return 0;* *}* *int max = a[0], min = a[0];* *int i = 0;* * * *int *hash = (int*) calloc(n, sizeof (int));* * * *//find min and max from the array* *for (i = 1; i < n; i++) {* *if (a[i] < m

Re: [algogeeks] MS Question

2011-07-05 Thread Navneet Gupta
See diff documentation. It's an application of Longest Common Subsequence problem. http://en.wikipedia.org/wiki/Diff On Wed, Jul 6, 2011 at 11:12 AM, priyanshu wrote: > What is the most efficient way to compare two text documents?? Also we > need to find the percentage by which they match.. > > T

Re: [algogeeks] MS

2011-07-05 Thread Ashish Goel
things to consider 1. priority(static, dynamic(based on wait and usage time), priority boost) 2. busy hrs vrs non-busy hrs stop time 3. when idle, should stop at highest traffic generation floor 4. weight factor to decide if to stop or not 5. multiple elevators, some for lower f

Re: [algogeeks] facebook

2011-07-05 Thread Harshal
thanks for the info DK. On Wed, Jul 6, 2011 at 11:21 AM, DK wrote: > I've gone through their process. The questions are simpler than those for > Google but they look for a different set of qualities in their hires than > Google so your CV and reccos (if asked) are important. I'm posting via > mo

[algogeeks] facebook

2011-07-05 Thread DK
I've gone through their process. The questions are simpler than those for Google but they look for a different set of qualities in their hires than Google so your CV and reccos (if asked) are important. I'm posting via mobile so I cant post any questions right now. -- DK -- You received this

[algogeeks] Re: Bipartite Matching?

2011-07-05 Thread Nitish Garg
Thanks got it. Was about to post this same algorithm after I went through graph coloring. -- 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/-/HrLarvKcZ-MJ. To p

[algogeeks] MS Question

2011-07-05 Thread priyanshu
What is the most efficient way to compare two text documents?? Also we need to find the percentage by which they match.. Thanks, priyanshu -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googleg

[algogeeks] Re: Bipartite Matching?

2011-07-05 Thread DK
Yup. That answer is correct. In simpler terms, color vertices white and black alternately as they are explored in BFS order (child of a black node is white and vice versa). If you come across a colored vertex, check its color - if it is the same as what you wanted to give it then skip the node (

[algogeeks] Re: Bipartite Matching?

2011-07-05 Thread 991
The question can be restated as follows: Given a graph, is it bipartite?. If yes, find the partition. A graph is bipartite if and only if there is no odd cycle. The following algo wl find the partition and if there is an odd cycle, it wl report that it is not possible. Level Decompose the graph

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread shiv narayan
@ashish thanx buddy nice solution On Jul 6, 7:20 am, Ashish Goel wrote: > Q3 : 42101000 > > started with 7000 > then changes this to > 6010 > 51000100 to > 42101000 to > > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > > > > >

Re: [algogeeks] Reason for banning

2011-07-05 Thread shady
only reason why any of the moderators must have banned you is either for advertising kind of mails, or abusive mails, spamming.. "I hope I get a reply to this instead of this ID also getting banned" oh come on there must have been something that got you banned, anyway you are not banned anymor

Re: [algogeeks] Re: Taking Input

2011-07-05 Thread saurabh singh
@SAGAR please explain ur preference for fgets instead of gets? On Tue, Jul 5, 2011 at 11:43 PM, sagar pareek wrote: > instead of using gets , use fgets > google the difference :) > > On Sun, Jul 3, 2011 at 3:42 AM, Avi Dullu wrote: > >> #include >> #include >> #include >> >> int main() {

Re: [algogeeks] MS Ques

2011-07-05 Thread Ashish Goel
just thinking aloud.. find substrings connected by ? like b,c, ensure that b?c is found, if not return false if found find 'a' like prefix in earlier part of the string.. Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Wed, Jul 6, 2011 at 12:02

[algogeeks] facebook

2011-07-05 Thread Harshal
has anyone gone through facebook recruitment process recently? If so, please provide the their process and if possible, the questions they asked... -- Best Regards, Harshal Choudhary 7th Semester, CSE Dept. NIT Surathkal, India. "The road to knowledge runs through the land of confusion." Mobile:

Re: [algogeeks] Re: VIRTUAL INHERITANCE

2011-07-05 Thread surender sanke
its two ints from X and Y classes :8 2 copies of int from Base class via Class X and Class Y :8 surender On Tue, Jul 5, 2011 at 10:39 PM, oppilas . wrote: > @T3rminal > Then how would you explain size of Z in case of normal inheritance( > sizeof(Z)=16 > > On Mon, Jul 4, 2011 at 4:08 AM, T3rmina

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread Ashish Goel
oops, did not see that someone had already answered it.. Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Wed, Jul 6, 2011 at 7:50 AM, Ashish Goel wrote: > Q3 : 42101000 > > > started with 7000 > then changes this to > 6010 > 51000100 to

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread Ashish Goel
Q3 : 42101000 started with 7000 then changes this to 6010 51000100 to 42101000 to Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Tue, Jul 5, 2011 at 11:54 AM, vikas wrote: > These all were asked cumulatively in five interviews, one

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread ankit arun
no 7000 is not possible because, '7' is also there so you have to mention at the index of '7' that it is there 1 time.. On Jul 6, 12:32 am, aditya kumar wrote: > in 7000 : '0' occurs seven times and rst of the numbers occur zero > times. i still dint get where i am wrong . plz explain me

[algogeeks] Re: Complexity QuickSort

2011-07-05 Thread Ritesh Srivastava
It will be O (n*log(n)). Recurrence relation will be T(n) = T(n/4) + T(3n/4) + O(n) Lets just say n=4^p so p=log n in base 4 so this will be the number of steps the array will be divided to get trivial constant size array. at every step , processing done will be O(n) because n -- > for firs

[algogeeks] Reason for banning

2011-07-05 Thread Sanket
Hi, I was using a different ID for browsing and commenting on this group but since yesterday, I am getting a notification that the moderator has banned me from using this group. I wanted to know the reason why I was banned and whether this was in error because I don't remember doing anything which

[algogeeks] Complexity QuickSort

2011-07-05 Thread oppilas .
If u could find the (n/4)th element of an array in O(n) time, then what is the worst time complexity of quick sort algo if this algo is used to decide the pivot element. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, s

Re: [algogeeks] Bipartite Matching?

2011-07-05 Thread Nitish Garg
Can you point me through any tutorial for Graph Coloring? I think CLRS does not explain graph coloring. -- 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/-/KS8

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread aditya kumar
@piyush : thanks i thot most significant bit was take as fisrt figure . On Wed, Jul 6, 2011 at 1:03 AM, Piyush Kapoor wrote: > 7 occurs 1 time... > so 8th digit is 1 > > On Wed, Jul 6, 2011 at 1:02 AM, aditya kumar > wrote: > >> in 7000 : '0' occurs seven times and rst of the numbers occur

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Nitish Garg
But '7' has also appeared One time, you need to take that into account. -- 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/-/djbLMkBkRiUJ. To post to this group,

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Piyush Kapoor
7 occurs 1 time... so 8th digit is 1 On Wed, Jul 6, 2011 at 1:02 AM, aditya kumar wrote: > in 7000 : '0' occurs seven times and rst of the numbers occur zero > times. i still dint get where i am wrong . plz explain me . > > > On Wed, Jul 6, 2011 at 12:47 AM, L wrote: > >> @aditya : I am wond

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread aditya kumar
in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L wrote: > @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is > it 0? > > Please take a moment before posting yo

Re: [algogeeks] Bipartite Matching?

2011-07-05 Thread radha krishnan
never mind am wrong ! :P :P On Tue, Jul 5, 2011 at 12:07 PM, radha krishnan wrote: > This is a gud question  thougth the answer is not bipartitie matching > > If the graph has a cycle then answer is impossible > The next question is whether the graph is connected ? > say 1)when the graph is conne

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread L
@aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar wrote: > Q3. ans:7000 i guess this is also a correct answer and no unique soln as > such >

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread aditya kumar
Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar wrote: > boolean palindromeCheck(String string) > { > len=string.length(); > if((string.length()>1)) > { > if((string.charAt(0)==string.charAt(len-1))) > { > str="";

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread aditya kumar
boolean palindromeCheck(String string) { len=string.length(); if((string.length()>1)) { if((string.charAt(0)==string.charAt(len-1))) { str=""; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointe

Re: [algogeeks] Bipartite Matching?

2011-07-05 Thread radha krishnan
This is a gud question thougth the answer is not bipartitie matching If the graph has a cycle then answer is impossible The next question is whether the graph is connected ? say 1)when the graph is connected then it should be a tree to get split into two groups easily by assigning some colors / (

Re: [algogeeks] Bipartite Matching?

2011-07-05 Thread Gunjan Sharma
I think Graph Coloring!! On Wed, Jul 6, 2011 at 12:25 AM, Nitish Garg wrote: > Given a network of the employees of a company such that edges are between > those employees who are friends to each other. Divide the employees into two > teams such that no two people who are friends to each other ar

[algogeeks] Bipartite Matching?

2011-07-05 Thread Nitish Garg
Given a network of the employees of a company such that edges are between those employees who are friends to each other. Divide the employees into two teams such that no two people who are friends to each other are in the same team? I was asked this question during the phonic interview with G

Re: [algogeeks] linked list

2011-07-05 Thread sagar pareek
yeah. it totally depends on the no. of data fields :) On Mon, Jul 4, 2011 at 2:03 PM, sunny agrawal wrote: > @Sagar > if it has a large no of data fields than don't u think just changing > pointers will be much better than swapping all the data contained in the > node > > On Mon, Jul 4, 2011

Re: [algogeeks] find output

2011-07-05 Thread sagar pareek
this will help you try the following :- *p++ (*p)++ *(p++) ++*p *++p all your confusions will flushed out :) On Mon, Jul 4, 2011 at 1:25 PM, Deoki Nandan wrote: > when u use post increment operator in an expression and there is sequence > point like || or && then value of post increment counted

Re: [algogeeks] MS Ques

2011-07-05 Thread Piyush Sinha
Can we do it using suffix trees and apply DFS on it?? On Tue, Jul 5, 2011 at 11:45 PM, swetha rahul wrote: > Hi, > Write a function which takes two char * s as inputs, one is a > regular expression pattern and the other is a test string and check whether > the test string is of the

[algogeeks] Re: help to code

2011-07-05 Thread shiv narayan
@ tushar just one modification to you code would make the things correct.makin  if (a % 2*prime[b] == 0) inspite of  if (a % prime[b] == 0) would take care of even things hope i am correct.. thanx! for the reply On Jul 5, 10:47 pm, Tushar Bindal wrote: > If my interpretation is right, following

[algogeeks] Re: help to code

2011-07-05 Thread shiv narayan
@ tushar as per your interpretation this looks coreect...but i am not saying to exclude all no's which are divisible by first 5 prime no ..question says to exclude those no which are evenly divisible by first 5 prime no.. On Jul 5, 10:47 pm, Tushar Bindal wrote: > If my interpretation is right, f

[algogeeks] MS Ques

2011-07-05 Thread swetha rahul
Hi, Write a function which takes two char * s as inputs, one is a regular expression pattern and the other is a test string and check whether the test string is of the given regular expression pattern. The regular expression pattern can contain all lower-case letter, asterisk and ques

Re: [algogeeks] Longest substring 0's & 1's

2011-07-05 Thread amit kumar
#include #define n 11 int main() { int ar[n]={1,0,1,1,1,0,0,0,0,0,1}; int a[n][n]; int l,i,k,maxlength=0,start,end; for(i=0;imaxlength) { maxlength=l; start=i; end=i+l-1; } }

Re: [algogeeks] Re: Taking Input

2011-07-05 Thread sagar pareek
instead of using gets , use fgets google the difference :) On Sun, Jul 3, 2011 at 3:42 AM, Avi Dullu wrote: > #include > #include > #include > > int main() { > int n, num, i; > scanf("%d", &n); > for (i = 0; i < n; ++i) { > char ch = '#'; > printf("scanned from %d line: ", i

Re: [algogeeks] Re: Sort - Consecutive Array in O(n)

2011-07-05 Thread Ganga Kameswaran
@sunny I dont understand the final checking part..Can u pls explain. On Sun, Jul 3, 2011 at 5:48 AM, Gene wrote: > You can use a count sort, but you need an array to store the counts. > The oppilas algorithm needs only constant extra storage. > > On Jun 30, 7:23 am, hary rathor wrote: > > can

Re: [algogeeks] help to code

2011-07-05 Thread Tushar Bindal
If my interpretation is right, following should be the code. int main() { int userInteger = 0; cout << "Enter A Number "<> userInteger; // Ask For a number from the user if (userInteger > 0) // Is the number valid? { int result = 0; int prime[5] = { 2, 3, 5, 7, 11 }; int a,b, count = 0; *for(a=1;

Re: [algogeeks] help to code

2011-07-05 Thread Tushar Bindal
I think you are getting it wrong. Surender, your solution says that numbers divisible by all of the first 5 prime numbers will be taken into account whereas the question says that only the numbers *not* evenly divisible by *any* of the first 5 prime numbers are to be added. Shiv, you are making tw

Re: [algogeeks] help to code

2011-07-05 Thread surender sanke
val = 2*3*5*7*11 for(i = 0 to n-1) if(val%a[i] == 0) count++,sum+=a[i]; surender On Tue, Jul 5, 2011 at 10:10 PM, Rajeev Bharshetty < rajeev.open.1...@gmail.com> wrote: > Clarification : The number (count) is the number of elements between 1 and > n which are not evenly divisible by 5 pri

Re: [algogeeks] Re: VIRTUAL INHERITANCE

2011-07-05 Thread oppilas .
@T3rminal Then how would you explain size of Z in case of normal inheritance( sizeof(Z)=16 On Mon, Jul 4, 2011 at 4:08 AM, T3rminal wrote: > @abc abc > 4th class= two ints from X and Y classes + one int from base class( as > this class is shared ) + 2 virtual pointers of X and Y classes. > Accor

Re: [algogeeks] Re: Interview Question

2011-07-05 Thread sunny agrawal
yes Heap Build is O(n) but after build it will be nlgn for comparision. isn't it ? On Tue, Jul 5, 2011 at 10:07 PM, vaibhav agarwal wrote: > @Dave bt the heap build operation is O(n) there is a proof fr this > > > On Tue, Jul 5, 2011 at 6:29 AM, saurabh singh wrote: > >> Yes I know I said it w

Re: [algogeeks] Re: Interview Question

2011-07-05 Thread vaibhav agarwal
http://www.cim.mcgill.ca/~langer/250/2010/lecture24.pdf On Tue, Jul 5, 2011 at 12:37 PM, vaibhav agarwal wrote: > @Dave bt the heap build operation is O(n) there is a proof fr this > > > On Tue, Jul 5, 2011 at 6:29 AM, saurabh singh wrote: > >> Yes I know I said it with regard to the current

Re: [algogeeks] help to code

2011-07-05 Thread Rajeev Bharshetty
Clarification : The number (count) is the number of elements between 1 and n which are not evenly divisible by 5 prime numbers and the result is the sum of all the numbers between 1 and n which are not evenly divisible by 5 prime numbers . Right??? For Example : if n=5 then

Re: [algogeeks] Re: Interview Question

2011-07-05 Thread vaibhav agarwal
@Dave bt the heap build operation is O(n) there is a proof fr this On Tue, Jul 5, 2011 at 6:29 AM, saurabh singh wrote: > Yes I know I said it with regard to the current problem > > On Tue, Jul 5, 2011 at 8:58 AM, Dave wrote: > >> @Saurabh: Nope. You can construct a heap in-place. But it is no

Re: [algogeeks] Unique substring

2011-07-05 Thread Aakash Johari
Its probably Longest repeating substring problem. So it can be solved with suffix array/tree easily in O(n) time. On Tue, Jul 5, 2011 at 9:07 AM, Akshata Sharma wrote: > @aakash: see this. I came across this question here > > http://geeksforgeeks.org/forum/topic/largest-unique-substring-from-a-st

Re: [algogeeks] Unique substring

2011-07-05 Thread Akshata Sharma
@aakash: see this. I came across this question here http://geeksforgeeks.org/forum/topic/largest-unique-substring-from-a-string-google On Tue, Jul 5, 2011 at 3:15 PM, Aakash Johari wrote: > Please make problem clear with example. Longest unique substring is the > string itself, or i have misund

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Azhar Hussain
For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end < start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas wrote: > My program for Q4. >

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread uttam tiwari
@anonymous: nopes , it's wrong1 is one time there so that should be their at index 1.. -- 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 e

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread anonymous procrastination
The answer to question 3 can also be 6010 right? so no unique solution? -- 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

[algogeeks] Help!!

2011-07-05 Thread KK
This is the solution to the MST problem m getting WA again n again... cant figure out where's the mistake... so plzzz help!!! https://www.spoj.pl/problems/BLINNET/ #include #include #include #include #include #define MAXINT (int)9e9 #define TR(a,it)for(typeof((a).begin()) it=(a).beg

Re: [algogeeks] Re: find output

2011-07-05 Thread Vishal Thanki
+1 @Sankalp On Tue, Jul 5, 2011 at 5:02 PM, sankalp srivastava wrote: > A better place to put these types of questions would be www.stackoverflow.com > > On Jul 4, 10:45 pm, amit kumar wrote: >> thanx guys... >> >> On Mon, Jul 4, 2011 at 5:11 PM, mahesh.jnumc...@gmail.com < >> >> >> >> >> >> >>

[algogeeks] Re: find output

2011-07-05 Thread sankalp srivastava
A better place to put these types of questions would be www.stackoverflow.com On Jul 4, 10:45 pm, amit kumar wrote: > thanx guys... > > On Mon, Jul 4, 2011 at 5:11 PM, mahesh.jnumc...@gmail.com < > > > > > > > > mahesh.jnumc...@gmail.com> wrote: > > In while loop, the value of i will be used as 0

[algogeeks] Re: array size problem

2011-07-05 Thread sankalp srivastava
due to constant folding On Jul 4, 6:54 am, Navneet Gupta wrote: > If you can, refer to "Constants" chapter in Bruce Eckel. He he smartly > explained how const are different for C & C++. > > The e-book is free to download from net. > > > > > > > > > > On Mon, Jul 4, 2011 at 2:50 AM, Gene wrote: >

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread saurabh singh
I mean is the solution valid? Because pushing will take one traversal and then popping another? On Tue, Jul 5, 2011 at 4:58 PM, Dumanshu wrote: > @Saurabh: u can improve upon ur solution. > > char * outstr; > int c =0; > void getreversedwords(string str) > { > index = str.length()-1; > //outstr

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Dumanshu
@Saurabh: u can improve upon ur solution. char * outstr; int c =0; void getreversedwords(string str) { index = str.length()-1; //outstr is the answer stack st; while(index) { st.push(str[index]); if(st.top() == ' ') //top is a space st.printstack(); index--; } if(st.isEmpty()==false) st.printstack

Re: [algogeeks] Re: 2 D array(dynamic allocation)

2011-07-05 Thread Vishal Thanki
Hi Gene, I was thinking the same thing which you implemented in your first snippet. But I tried it without using typedef. Following is my code: #include #include int main() { int (*ptr)[4] ; ptr = (int ((*)[4]))malloc(2*sizeof(int (*)[4])); if (ptr) { in

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread saurabh singh
well for question 6 I think calculating size of string will count as one traversal? Correct me if I am wrong? My approach: traverse storing each char in a string.when space encountered push the string in stack I am not sure how my solution is but it doesnt appears gud ryt now. On Tue, Jul 5, 20

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Dumanshu
@Azhar: could u plz explain the q8. problem. On Jul 5, 12:13 pm, Azhar Hussain wrote: > Q8 is a DP problem, here is the solution > > #include > > #define MAX 125 > #define VAL 6 > int Min[MAX]; > int N[VAL] = {5, 10, 20, 25, 50, 100}; > > int main(void) > { >     int i, j; > >     for (i = 1; i

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Dumanshu
ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that case the number must have a zero digit because 1st digit the n

[algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread ankit mehta
I think that for Q3 answer will be unique and will be same as pointed out by Ritesh. On Jul 5, 1:11 pm, vikas wrote: > "Sum of all the digits should be 8" > > But it was not said by the interviewer i think we must print all possible > combinations for the question -- You received this message b

Re: [algogeeks] Re: Interview Question

2011-07-05 Thread saurabh singh
Yes I know I said it with regard to the current problem On Tue, Jul 5, 2011 at 8:58 AM, Dave wrote: > @Saurabh: Nope. You can construct a heap in-place. But it is not O(n). > > Dave > > On Jul 4, 10:02 pm, saurabh singh wrote: > > Again heap will require extra space. > > > > On Tue, Jul 5, 2011

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread Ritesh Srivastava
I don't think if there can be more than one possible answer to this question.Q3 -- 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/-/iCMXpZK37E0J. To post to th

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread Ritesh Srivastava
@Vikas It was my observation. @abhishek Sum of digits will be 8 because all the digits tell you the number of times they appear Lets just say the number is Number --> a b c d e f g h @Digits > 0 1 2 3 4 5 6 7 a+b+c+d+e+f+g+h = 8 One more observation : a*0 + b*1 + c*2 + d*3 + e*4 + f*5 + g*6

Re: [algogeeks] Unique substring

2011-07-05 Thread Aakash Johari
Please make problem clear with example. Longest unique substring is the string itself, or i have misunderstood the problem. On Mon, Jul 4, 2011 at 11:53 PM, Navneet Gupta wrote: > I think you guys are on different page. There is a difference between > substring and subsequence. > http://en.wikipe

[algogeeks] test cases

2011-07-05 Thread segfault
Tell me how to write a test cases for given c program which are asked in interview ? Please give some examples. Any website for it? -- 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.co

Re: [algogeeks] Implementing QUEUE with Singly link list

2011-07-05 Thread vaibhav shukla
and i have solved ;) with just one pointer ;) On Tue, Jul 5, 2011 at 11:25 AM, Sandeep Jain wrote: > OOPS... I missed again, my bad... both enqueue and deque can take > reference. (Sincere apologies...) > NO separate data structure is needed. > And both operations can definitely be done, in O(n)

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread vikas
"Sum of all the digits should be 8" But it was not said by the interviewer i think we must print all possible combinations for the question -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https:/

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread abhishek iyer
@Ritesh : Can u explain ur approach for Q3 please?? On Tue, Jul 5, 2011 at 1:20 PM, Ritesh Srivastava wrote: > For Q3 . > Sum of all the digits should be 8. > > > I think , > 42101000 is an answer. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Ge

Re: [algogeeks] Re: Nagarro Question

2011-07-05 Thread juver++
@navneet If you want to make it in O(n^2) simple scheme like insertion sort works well and very simple! -- 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/-/Rv3

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread Ritesh Srivastava
For Q3 . Sum of all the digits should be 8. I think , 42101000 is an answer. -- 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/-/2nUWgrZuNvAJ. To post to this

[algogeeks] Spaghetti Sort

2011-07-05 Thread varun gupta
Can someone give me coding implementation of spaghetti sort in java or c/c++. I know the steps but i wonder how it can be implemented. http://en.wikipedia.org/wiki/Spaghetti_sort -- Warm Regards, Varun Kumar Email Id: varun.gt...@gmail.com Contact: +91-9711751235 -- You received this message b

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread piyush jain
q2.: Basically u must put 10min and 5 min together to save time. also, during return path-u must have some1 with less time already there. that's it ! On Tue, Jul 5, 2011 at 1:00 PM, udit sharma wrote: > > Q-8: 50,25,10,10,10,10 > > Q2-: Let A,B,C and D are the persons suct tat A takes 1min,

Re: [algogeeks] Some adobe interview questions.

2011-07-05 Thread Azhar Hussain
Well that sounds interesting. You can read more info here http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=dynProg If you don't understand please explain which parts you don't understand. We can discuss it then. Its a bit of lengthy explanation about DP. Lots of websites have notes on it.

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread udit sharma
Q-8: 50,25,10,10,10,10 Q2-: Let A,B,C and D are the persons suct tat A takes 1min, B-2, C-5 and D-10 * A and B go across 2 minutes A goes back with light 1 minute C and D go across 10 minutes B goes back with light 2 minute A and

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread shady
don't give programs.. discuss the logic behind that, algorithms are important.. On Tue, Jul 5, 2011 at 12:43 PM, Azhar Hussain wrote: > Q8 is a DP problem, here is the solution > > #include > > #define MAX 125 > #define VAL 6 > int Min[MAX]; > int N[VAL] = {5, 10, 20, 25, 50, 100}; > >

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-05 Thread Azhar Hussain
Q8 is a DP problem, here is the solution #include #define MAX 125 #define VAL 6 int Min[MAX]; int N[VAL] = {5, 10, 20, 25, 50, 100}; int main(void) { int i, j; for (i = 1; i < MAX; i++) Min[i] = 100; for (i = 5; i < MAX; i += 5) for (j = 0; j < VAL; j++)