Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-09-02 Thread annarao kataru
@sharmila u r using + operator -- 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

[algogeeks] Re: Data Structure Question

2011-09-02 Thread sharmila saru
stack bcoz push pop in FIFO manner -- 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/-/MTgxHW5Jq9YJ. To post to this group, send email to

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-09-02 Thread siddharam suresh
if this is the case program can be rewritten to #Iincludestdio.h #includeconio.h void main() { int a,b,i; clrscr(); printf(enter 2 num:); scanf(%d%d,a,b); while(b--) a++; printf(%d,a); getch(); } Thank you, Sid. On Fri, Sep 2, 2011 at 11:30 AM, annarao kataru kataruanna...@gmail.comwrote:

Re: [algogeeks] Re: Fwd: 8 queens problem

2011-09-02 Thread mc2 .
thanks guys On Fri, Sep 2, 2011 at 1:53 AM, Don dondod...@gmail.com wrote: There are several issues. There is nothing to back out a move if it fails. After the recursive call to queen, you need an else which unmarks the board. That will be hard to do, because there isn't a good way to

[algogeeks] Re: Hexadecimal to Decimal

2011-09-02 Thread Don
Sure there are other ways. But why duplicate functionality already built into the language? Here is one way to write your own conversion function: int hexToDec(char *string) { int x = 0; for(int i = 0; string[i]; ++i) { if (isdigit(string[i])) x = (x*16) + string[i] - '0';

[algogeeks] Re: Hexadecimal to Decimal

2011-09-02 Thread Don
Sure. Is something wrong with using the functionality already built into the language? Here is another way: int hexToDec(char *string) { int x = 0; for(int i = 0; string[i]; ++i) { if (isdigit(string[i])) x = (x*16) + string[i] - '0'; else if ((string[i] = 'a') (string[i] =

Re: [algogeeks] Motorola Interview Question

2011-09-02 Thread Yuchen Liao
That means to prevent the driver from auto loading. Just open */etc/modprobe.d/blacklist* file and add the driver name using: *blacklist driver_name* On Thu, Sep 1, 2011 at 1:29 AM, rajeev bharshetty rajeevr...@gmail.comwrote: What does Blacklisting of drivers mean in Linux ? Explain How

[algogeeks] Urgent

2011-09-02 Thread Ishan Aggarwal
Hi, Anyone aware what facebook asks in their first phone call, regarding general background details and other related information and what should be prepared for their interview? -- Kind Regards Ishan Aggarwal Phone : +91-9654602663 -- You received this message because you are subscribed to

Re: [algogeeks] subarray wid sum=k

2011-09-02 Thread hemank lamba
Are you sure it is not continuous subsets. Because otherwise i guess it is a NP problem. On Fri, Sep 2, 2011 at 7:58 AM, manish kapur manishkapur.n...@gmail.comwrote: given an unsorted array of +ve and -ve elements.find a subarray with sum= k in O(n). you can use some extra space -- You

Re: [algogeeks] akamai

2011-09-02 Thread sukran dhawan
how much they pay ? On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar aditya.kumar130...@gmail.comwrote: they basically ask questions on DBMS and networking. In DBMS fst round mainly had SQL and 1 coding question related to ER DIAGRAM . in written round 3 question ws thr 1)ER diagram 2)stack n

Re: [algogeeks] subarray wid sum=k

2011-09-02 Thread wujin chen
agree with hemank ! 2011/9/2 hemank lamba hemankla...@gmail.com Are you sure it is not continuous subsets. Because otherwise i guess it is a NP problem. On Fri, Sep 2, 2011 at 7:58 AM, manish kapur manishkapur.n...@gmail.comwrote: given an unsorted array of +ve and -ve elements.find a

[algogeeks] Re: Find the Max from each sub-array of size k

2011-09-02 Thread amit chandel
we can do it using max heap -- 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

Re: [algogeeks] Re: Find the Max from each sub-array of size k

2011-09-02 Thread sukran dhawan
for(i=0;in;i++) { max = a[i]; for(j=1;jk;j++) { if(max a[j]) max = a[j]; } //print } On Fri, Sep 2, 2011 at 1:57 PM, amit chandel samit.iiit...@gmail.comwrote: we can do it using max heap -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] subarray wid sum=k

2011-09-02 Thread manish kapur
u have 2 find a continuous subarray... -- 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

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

2011-09-02 Thread sukran dhawan
define the variable if u wanna remove the error :P On Wed, Aug 31, 2011 at 8:26 PM, Rajesh Kumar testalgori...@gmail.comwrote: What we do to remove error?? #includestdio.h extern int var; main() { var=10; return 0; } Regards Rajesh Kumar -- You received this message because you

[algogeeks] Re: subarray wid sum=k

2011-09-02 Thread WgpShashank
I Think We can Use HashTable , as Its Sub-Array you are asking about , its obviously contiguous :D Calculate prefix sum , store it in hashtable as key current index as value , once prefix sum=k, print subarray , also keep track of prev index , so that we can print array from prev_i9ndex to

[algogeeks] REGARDING SOURCE BITS

2011-09-02 Thread karthik fbk
Hi guys , source bits is visiting our college next week . If it has come to any of your colleges , share your experience in it. What kind of questions will they ask in written and also in interview process . It would be helpful .. -- You received this message because you are subscribed to the

[algogeeks] Information about TATA Systems

2011-09-02 Thread pcsin
Hello, Can anybody provide me with information about TATA systems, broadly about what kind of company they are. Googling doesn't leads to any result. Awaiting the response. :-) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread manish kapur
r u sure space used is O(n)? -- 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

[algogeeks] Re: Adding Two no without using any operator...??

2011-09-02 Thread WgpShashank
Discussed Several time , Search Threads here is one of the link https://groups.google.com/forum/#!searchin/algogeeks/add$20two$20number$20/algogeeks/laWTN1xiwx0/lYoidUsr7mIJ Thanks Shashank Mani Computer Science Birla Institute of Technology Mesra -- You received this message because you

Re: [algogeeks] convert a string into another in minimum number of steps

2011-09-02 Thread WgpShashank
Yes Edit Distance is Most Efficient Algorithms Implemented So far and we all know this :P , but Sukran is saying Trie ? seems odd initially but let me analyze it ,Seems Good to me but we need to store length of strings in advance so that while inserting in trie wherever 1st mismatch occurs ,

Re: [algogeeks] Find the Max from each sub-array of size k

2011-09-02 Thread WgpShashank
Hi Anup , here is naive approach There is a sliding window of size w which is moving from the very left of the array to the very right. You can only see the w numbers in the window. Each time the sliding window moves rightwards by one position. Following is an example: The array is [1 3 -1

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread hemank lamba
The problem in this solution might be the fact that you will get the sub array only if the prefix sum is k... so here we are not using prev index. On Fri, Sep 2, 2011 at 3:17 PM, WgpShashank shashank7andr...@gmail.comwrote: I Think We can Use HashTable , as Its Sub-Array you are asking about ,

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
@shasank; i don't think it works... prefix sum means u are taking sum from starting index ... sub array can be from middle ..It is like max sub array in an array problem ...O(n^2) algo is available in Cormen text book .google it . On Fri, Sep 2, 2011 at 6:05 AM, manish kapur

[algogeeks] C project

2011-09-02 Thread Rajeshwar Patra
There was a book named as C projects Does anyone has a link for downloading the book. -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: Data Structure Question

2011-09-02 Thread sukran dhawan
stack On Fri, Sep 2, 2011 at 11:32 AM, sharmila saru sharmi99p...@gmail.comwrote: k k -- 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/-/C6ETapRdgvQJ. To

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread Neha Singh
@Shashank : I think the sub array need not start from the the index 0. For eg: If the array is of size 10, then the sub array can be from index 3 to 7. Here is my solution : Given : int arr[size] , int sum 1. Take an array prefix_sum[size] 2. int temp=0;prefix_sum[0]=0; for(int i=0;isize;i++)

Re: [algogeeks] Find the Max from each sub-array of size k

2011-09-02 Thread vishal jain
I made a small program with window size k = 2; int max(int n, int m) { if ( n m ) return n; else return m; } int main() { int arr[8]={3,5,1,9,0,4,-1,7}; int i,j; for (i=0;i!=j i=7;i++) for (j=0;j!=i j=7; j++) { int k =

Re: [algogeeks] Find the Max from each sub-array of size k

2011-09-02 Thread rajul jain
I think Dave has already given a good solution in earlier post. first make a max heap of first k elements and then print max value which is root . now add next element in heap and again print max value follow this procedure till you reach end of an array. On Fri, Sep 2, 2011 at 9:04 AM, Anup

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
we can do this without taking O(n) space .. but time is O(n^2) as in i already mentioned where the solution is ... On Fri, Sep 2, 2011 at 7:35 AM, Neha Singh neha.ndelhi.1...@gmail.comwrote: @Shashank : I think the sub array need not start from the the index 0. For eg: If the array is of size

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
we have to consider 3 cases .. 1) that sub array can be in first half 2) that sub array can be in second half 3) that sub array can be in middle . On Fri, Sep 2, 2011 at 7:56 AM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: we can do this without taking O(n) space .. but time is

Re: [algogeeks] Static variable memory location

2011-09-02 Thread rahul sharma
function argument as stativ vairbales then tehy are creted on data segment and normal on stack. On Fri, Sep 2, 2011 at 11:27 AM, aditya kumar aditya.kumar130...@gmail.comwrote: static variables are allocated on heap . and global variables are sored on data segment On Fri, Sep

Re: [algogeeks] akamai

2011-09-02 Thread aditya kumar
Rs 100800 // this is CTC basic pay is around 7lakhs On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan sukrandha...@gmail.comwrote: how much they pay ? On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar aditya.kumar130...@gmail.com wrote: they basically ask questions on DBMS and networking. In

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread manish kapur
@bharatkumar..cn u pls share the algo -- 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

Re: [algogeeks] akamai

2011-09-02 Thread sukran dhawan
i think u missed a zero :) On Fri, Sep 2, 2011 at 5:49 PM, aditya kumar aditya.kumar130...@gmail.comwrote: Rs 100800 // this is CTC basic pay is around 7lakhs On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan sukrandha...@gmail.comwrote: how much they pay ? On Fri, Sep 2, 2011 at 11:24 AM,

[algogeeks] Re: Static variable memory location

2011-09-02 Thread Gene
The first sentence is incorrect for any compiler I've ever seen, and that's a bunch. As has been said, the C standard doesnt' say where _any_ variables live. So you can only ask the question with respect to certain compiler. On Sep 2, 1:57 am, aditya kumar aditya.kumar130...@gmail.com wrote:

[algogeeks] Need algorithm asap

2011-09-02 Thread kranthi raj
I have a list / array Y (with n elements in it), and write an algorithm which gives all valid bipartitions (Y1 ,Y2) of Y. -- Sincerely, Kranthi Raj A 2nd Mtech Dept Of Computer Science , Indian Institute of Technology, Madras #9884989577 -- You received this message

[algogeeks] IBM-ISL

2011-09-02 Thread Reynald
Hi guys! If any of is familiar with IBM-ISL recruitment process and interview questions, please post. Thank you. -- 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

[algogeeks] Re: microsoft interview

2011-09-02 Thread Vikram Singh
how abt this: if(!a[0][0]) { first traverse the 1st row till we find any 1... On Sep 2, 12:32 pm, kranthi raj kranthi...@gmail.com wrote: oops missed Space Complexity On Fri, Sep 2, 2011 at 12:55 PM, kranthi raj kranthi...@gmail.com wrote: for( i = 0 ; i n ; ++i )    for( j = 0 ;

[algogeeks] Re: microsoft interview

2011-09-02 Thread Vikram Singh
how abt this: if(!a[0][0]) { first traverse the 1st row till we find 1. if dere is 1 do a[0][0]+=2; then traverse the first column till 1.. if dere is 1... do a[0][0]+=3; } apply dave's method if(a[0][0]==2) make 1st row 1 else if(a[0][0]==3)

Re: [algogeeks] Find the Max from each sub-array of size k

2011-09-02 Thread beginner
i think the problem can also be solved by DP.. arr is the original array.. final is the array required.. for(i=0;in;i++) final[i]=arr[i]; for(i=2;i=k;i++) for(j=0;jn-i+2;j++) final[i]=max( final[j] , final[j+1]); initial n-i+2 entries in the array final contains the answer.. time

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread Ashima .
Logic: since n numbers are there,so there can be (2^n)-1 cases.Just as for n bits we have 2^n possible combinations. Keeping above logic in mind,We can also create a binary tree with root node as 0.From there create 2 child nodes:1)number 2) 0. 1st child node indicates that number was taken in

[algogeeks] activation record

2011-09-02 Thread priya ramesh
Allocation and deallocation of activation records is always done using a stack (LIFO) structure. True or false?? -- 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

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread manish kapur
@ashima..wat will b the complexity of ur algo? -- 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: Find Max Sum Value Pairs

2011-09-02 Thread Dave
@Shashank: Without looking over your algorithm in detail, let me just say that it solves a different problem than the one asked by the original poster. You are finding the kth maximum sum, but the problem asks to find all of the first n maximum sums. So you would have to apply your algorithm n

Re: [algogeeks] activation record

2011-09-02 Thread sukran dhawan
true On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh love.for.programm...@gmail.com wrote: Allocation and deallocation of activation records is always done using a stack (LIFO) structure. True or false?? -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: Find Max Sum Value Pairs

2011-09-02 Thread WgpShashank
@Dave Correct , Missed to Provide the Correct Time Complexity in Worst Case it Will be O(N^2) , as we need to find out n such maximum pair , will think about O(N0) Algo, if able to do it, will post the Algo here Thanks Shashank Mani Computer Science Birla Institute of Technology,Mesra --

Re: [algogeeks] uregent advice needdedddd........

2011-09-02 Thread santosh mahto
Samsung Bangalore.. I am working here. On Fri, Sep 2, 2011 at 8:21 PM, rahul sharma rahul23111...@gmail.comwrote: plz guys tell me wich samsung is better out of 3 in india...n plz suggest should i apply for samsung noida or not??? -- You received this message

Re: [algogeeks] activation record

2011-09-02 Thread Kamakshii Aggarwal
what are activation records?? On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan sukrandha...@gmail.comwrote: true On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh love.for.programm...@gmail.com wrote: Allocation and deallocation of activation records is always done using a stack (LIFO)

[algogeeks] solution

2011-09-02 Thread MADHUSUDAN BALAI
What we do to remove error?? #includestdio.h extern int var; main() { var=10; return 0; }* Answer : *Linker Error : Undefined reference to 'var' * Explanation*: extern storage class in the following declaration, extern int var; specifies to the compiler that the memory for i is allocated in

Re: [algogeeks] Find the Max from each sub-array of size k

2011-09-02 Thread Anup Ghatage
I just checked Shashank's blog post. The Deque solution is awesome :) -- 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

[algogeeks] Info works applications

2011-09-02 Thread raj kumar
Is there anyone in this group who cleared the prior examination of works applications.. reply asap 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

Re: [algogeeks] uregent advice needdedddd........

2011-09-02 Thread prince . gupta117
SISO Banglore is best among 3 , then SISC Noida and then SEL Noida. On Fri, Sep 2, 2011 at 8:21 PM, rahul sharma rahul23111...@gmail.comwrote: plz guys tell me wich samsung is better out of 3 in india...n plz suggest should i apply for samsung noida or not??? --

[algogeeks] dictionary

2011-09-02 Thread Aman Kumar
Hii Which data structures can be used for implementation for dictionary? which is best/good among them? provide good link for that. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Amazon Interview

2011-09-02 Thread Rahul Verma
Hi friends, Is there anyone who given the first telephonic round of Amazon recently. Please share the details with us. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] akamai

2011-09-02 Thread aditya kumar
haha ya i missd one zero its rs 1008000 ctc On Fri, Sep 2, 2011 at 6:09 PM, sukran dhawan sukrandha...@gmail.comwrote: i think u missed a zero :) On Fri, Sep 2, 2011 at 5:49 PM, aditya kumar aditya.kumar130...@gmail.com wrote: Rs 100800 // this is CTC basic pay is around 7lakhs On

Re: [algogeeks] Need algorithm asap

2011-09-02 Thread Piyush Kapoor
I think it is simply printing the subsets.Let Y1 be a subset,then Y-Y1 will be Y2,which will give u all the partitions... On Fri, Sep 2, 2011 at 7:04 PM, kranthi raj kranthi...@gmail.com wrote: I have a list / array Y (with n elements in it), and write an algorithm which gives all valid

Re: [algogeeks] dictionary

2011-09-02 Thread sukran dhawan
trie data structure On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar amanas...@gmail.com wrote: Hii Which data structures can be used for implementation for dictionary? which is best/good among them? provide good link for that. -- You received this message because you are subscribed to the

Re: [algogeeks] dictionary

2011-09-02 Thread somya mishra
trie On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan sukrandha...@gmail.comwrote: trie data structure On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar amanas...@gmail.com wrote: Hii Which data structures can be used for implementation for dictionary? which is best/good among them? provide

[algogeeks] Re: Need algorithm asap

2011-09-02 Thread WgpShashank
Piyush Has Correct Idea, If You Have N elements in Set/Array You Will Have Maximum 2^n Subsets (Power Set), Now Problem Reduced to generate the all such subsets , it will take O(2^n*n ) time , Now number of Valid Bipartitions are exactly n/2 . Note: Power Set includes 0 as well Correct me

Re: [algogeeks] activation record

2011-09-02 Thread rajeev bharshetty
http://www.enel.ucalgary.ca/People/Norman/enel339fall2000/activ_rec/ False On Fri, Sep 2, 2011 at 10:13 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: what are activation records?? On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan sukrandha...@gmail.comwrote: true On Fri, Sep 2, 2011

[algogeeks] pattern matching

2011-09-02 Thread Aman Kumar
Hiii Friends ,if pattern matching question is asked in the interview , we should answer brute force(with some optimization) approach or use ADVANCED algorithm like KMP? I am very much confused regarding this because in on blog i have read that we should not use advanced data structure in

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread WgpShashank
@bharat , I never Said that subarray can't start from middle or have to start from 0th index :) Shashank Mani Computer Science Birla Institute of Technology,Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on

Re: [algogeeks] dictionary

2011-09-02 Thread Yuchen Liao
Trie is good, but I prefer inverted index. On Fri, Sep 2, 2011 at 1:38 PM, somya mishra somya.bvm...@gmail.com wrote: trie On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan sukrandha...@gmail.comwrote: trie data structure On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar amanas...@gmail.com

[algogeeks] Find the Max from each sub-array of size k Options

2011-09-02 Thread icy`
comparison/benchmarks of the 1) naive method, which just calls max with every new index, up to size of array - k 2) my method , which only makes a call to max if the old max is out of range or the newest/very rightmost element is greater than max ruby code: [image: max_subarray_text.png]

[algogeeks] Re: Find the Max from each sub-array of size k Options

2011-09-02 Thread icy`
I apologize to the group; i meant to post as reply to Find the Max from each sub-array of size k but I accidentally selected the word Options as well. Sorry. On Sep 2, 3:42 pm, icy` vipe...@gmail.com wrote: comparison/benchmarks of the 1) naive method, which just calls max with every new

Re: [algogeeks] pattern matching

2011-09-02 Thread Ankur Garg
Use KMP dude if u know it ...Who told not to use it ?? Dont read absurd things from net Regards Ankur On Sat, Sep 3, 2011 at 12:35 AM, Aman Kumar amanas...@gmail.com wrote: Hiii Friends ,if pattern matching question is asked in the interview , we should answer brute force(with some

Re: [algogeeks] Re: Find Max Sum Value Pairs

2011-09-02 Thread Piyush Grover
if I have understood the question correctly then: a[n-1] + b[i] a[j] + b[i] for all 0 = j n-1 and a[j] + b[n-1] a[j] + b[i] for all 0 = i n-1 therefore, i = j =n-1; count = 1; S[0] -- (a[n-1], b[n-1]) p = a[n-1] + b[n-2]; q = a[n-2] + b[n-1] while(count n){ if(p q){ j--;

[algogeeks] Network Question

2011-09-02 Thread sagar pareek
It is urgent to get the answer thats why i m posting network question here... searching on net is not working HI !! I stuck on a question related to VLSM Suppose we have two subnets as 10.0.1.0/24 valid ip address can be 10.0.1.2 and 10.0.1.0/26 here also valid ip address can be 10.0.1.2

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread WgpShashank
Yes Neha, I Never Said That SubArray has to be Started from 0th index,else What Will be the advantage of this saying subarray anyways, here O(N) time O(N) space solution int prefix_sum = 0; hash_mapint,int find_subarray; int start_index = -1, end_index = -1; for (int i = 0,;i n;

Re: [algogeeks] Network Question

2011-09-02 Thread aditya kumar
their wont be any conflict in ip address . coz within dhcp assigns ip adsress from the pool of available address and within the n/w (LAN) we need to have unique ip address bt across the n/w (LAN) we can use same ip from the pool of ip addresses . On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek

[algogeeks] Re: IBM-ISL

2011-09-02 Thread Navneet
I had an offer from IBM ISL, but i did not accept it. The interview is not very tough. They asked me standard questions like detecting loop in linked list, level order traversal etc. Though i appeared directly for interview and had to write no written test as i was interning there. On Sep 2,

Re: [algogeeks] Re: Need algorithm asap

2011-09-02 Thread bharatkumar bagana
@shasank: how come the valid bipartition s are n/2.. those should be at least n right? ex: {1,2,3} {1},{2,3} --{1,2},{3} --{},{1,2,3} If this is correct , then for printing sake it takes O(n^2) . correct me if I'm wrong. On Fri, Sep 2, 2011 at 2:48 PM, WgpShashank

Re: [algogeeks] activation record

2011-09-02 Thread bharatkumar bagana
The activation records for all of the active functions are stored in the region of computer memory called *the stack*. A good way to remember this is to think of the stack as ``the region of memory where all the activation records are stacked''. Allocation and deallocation of activation records is

Re: [algogeeks] activation record

2011-09-02 Thread sukran dhawan
activation records keep tracks of information about the subroutines On Fri, Sep 2, 2011 at 10:13 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: what are activation records?? On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan sukrandha...@gmail.comwrote: true On Fri, Sep 2, 2011 at 7:44

Re: [algogeeks] pattern matching

2011-09-02 Thread sukran dhawan
start drom brue force.then interviewer will ask u to optimize it.then refine it.dont jum into the optimised soln directly On Sat, Sep 3, 2011 at 12:35 AM, Aman Kumar amanas...@gmail.com wrote: Hiii Friends ,if pattern matching question is asked in the interview , we should answer brute

Re: [algogeeks] dictionary

2011-09-02 Thread sukran dhawan
what is inverted index ? On Sat, Sep 3, 2011 at 12:53 AM, Yuchen Liao lycdra...@gmail.com wrote: Trie is good, but I prefer inverted index. On Fri, Sep 2, 2011 at 1:38 PM, somya mishra somya.bvm...@gmail.comwrote: trie On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan

Re: [algogeeks] Re: IBM-ISL

2011-09-02 Thread Reynald Suz
Thank you Navneet. On Sat, Sep 3, 2011 at 8:34 AM, Navneet navneetn...@gmail.com wrote: I had an offer from IBM ISL, but i did not accept it. The interview is not very tough. They asked me standard questions like detecting loop in linked list, level order traversal etc. Though i appeared

[algogeeks] Fire when ready!

2011-09-02 Thread Don
N identical Soldier finite automata are in a line in their Ready state. Each Soldier can change states once at every time interval based on its own current state and the states of the automata immediately to its right and left. At one end is the General in his Aim state. At the other end is the

Re: [algogeeks] dictionary

2011-09-02 Thread bharatkumar bagana
WHY trie? any reason ? Dictionary means not only to save efficiently and also we have to get back in almost O(1) time .. I think Hash Table is best suited for this... Or any way we have Dictionary Data Structure in Java.. On Fri, Sep 2, 2011 at 3:23 PM, Yuchen Liao lycdra...@gmail.com wrote:

Re: [algogeeks] Re: Find Max Sum Value Pairs

2011-09-02 Thread bharatkumar bagana
@pitush: pls explain your logic once On Fri, Sep 2, 2011 at 4:09 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: if I have understood the question correctly then: a[n-1] + b[i] a[j] + b[i] for all 0 = j n-1 and a[j] + b[n-1] a[j] + b[i] for all 0 = i n-1 therefore, i = j

Re: [algogeeks] Re: Need algorithm asap

2011-09-02 Thread Siddhartha Banerjee
no of valid bipartitions are 2^n, thats what he meant I guess... ( if you do not want null set as one of the partitions then subtract 1 from answer...) -- 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] Network Question

2011-09-02 Thread bharatkumar bagana
all the addresses which come under second addr will also come under first Can those 2 be exist in same LAN ? If yes , how can router decides to which subnet it has to pass through the incoming packet .. On Fri, Sep 2, 2011 at 6:36 PM, aditya kumar aditya.kumar130...@gmail.comwrote:

Re: [algogeeks] pattern matching

2011-09-02 Thread bharatkumar bagana
wht is KMP? pls give some info .. On Fri, Sep 2, 2011 at 11:59 PM, sukran dhawan sukrandha...@gmail.comwrote: start drom brue force.then interviewer will ask u to optimize it.then refine it.dont jum into the optimised soln directly On Sat, Sep 3, 2011 at 12:35 AM, Aman Kumar

Re: [algogeeks] Re: Closest ancestor of two nodes

2011-09-02 Thread rajul jain
@anika this solution only works for BST On Mon, Aug 15, 2011 at 4:20 PM, Anika Jain anika.jai...@gmail.com wrote: node *common_ancestor(node *root, node **prev, int x,int y) { if(root-a==x || root-a==y) return *prev; else if(root-a x root-a y) {

Re: [algogeeks] Re: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
ya , it can start from middle ...but continuous right .. On Fri, Sep 2, 2011 at 4:34 PM, WgpShashank shashank7andr...@gmail.comwrote: Yes Neha, I Never Said That SubArray has to be Started from 0th index,else What Will be the advantage of this saying subarray anyways, here O(N) time

Re: [algogeeks] Re: Find Max Sum Value Pairs

2011-09-02 Thread Siddhartha Banerjee
yeah piyush's solution seems correct to me... if current amx is from a[i],b[j], then next maximum can only be either of a[i-1],b[j] or a[i],b[j-1] continue!!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Re: Network Question

2011-09-02 Thread Vengadanathan
ya both the subnet can exisit in the same network , but problem is lack of communication between the two subnets ,because in routing table of the router the record for 10.0.1.0/26 will be first then record for 10.0.1.0/24 will be , so 10.0.1.0/26 will be given first preference , so subnet

[algogeeks] Hash Table

2011-09-02 Thread Rahul Verma
I am facing some difficulty in the implementation of Hash Table. Anyone can please share the good resources for Hash Table? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Hash Table ( A hashtable class in c++)

2011-09-02 Thread Aj G
#includecstdio #includemap #includevector #includecstdlib using namespace std; // It is not advisable to list all elements in this hash table. #define HASH_SIZE 51439 class HashTable { public: vector maplong long,int table; HashTable() { table = vector maplong long,int (HASH_SIZE);

Re: [algogeeks] Re: Network Question

2011-09-02 Thread bharatkumar bagana
I didn't understand so subnet 10.0.1.0/26 cannot communicate with 10.0.1.0/24 having same ip node more over packet sent within 10.0.1.0/24 will reach 10.0.1.0/26 not to the nodes on the same network .. so 10.0.1.0/24 can communicate with 10.0.1.0/26 but cannot communicate within itself .. what do

Re: [algogeeks] Re: Find Max Sum Value Pairs

2011-09-02 Thread Piyush Grover
Since A(n) and B(n) are sorted so in the pair (a[i], b[j]) either i = n-1 or j = n-1 or both. 1.) so the first element is (a[n-1], b[n-1]) 2.) now, we have two numbers to compare p = a[n-1]+ b[n-2] and q = a[n-2]+b[n-1] 3.) if pq then p = a[n-1]+b[n-3] else q = a[n-3] + b[n-1] and repeat in

Re: [algogeeks] Re: Closest ancestor of two nodes

2011-09-02 Thread bharatkumar bagana
For BST it is easy ...it can be find in O(logn) time .. when ever we find that the direction we are searching for x and y are different, that node is the common ancestor ...no need to find either x or y where the nodes are... what about binary tree ? how do we search an element in binary tree