[algogeeks] Apply to US

2013-06-22 Thread pacific :-)
Hi all, I would like to apply for US companies like google, twitter, linkedin, facebook for next year. Any suggestions how/when should i apply ? General suggestions on prep. Thanks in advance. -- regards, chinna. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: find a point closest to other points

2012-05-08 Thread pacific :-)
On Tue, May 1, 2012 at 8:44 PM, Bhupendra Dubey bhupendra@gmail.comwrote: Find the centroid X= (x1 +x2xn)/N Y=(y1+y2..yn)/N This will precisely be the point no need to calculate and check with distance. @dubey : Consider this case, let there be a cluster of 4 points near the

Re: [algogeeks] how to code a deterministic or Non-Deterministic finite state automata model?

2012-05-08 Thread pacific :-)
How about using function pointers ? On Fri, Apr 6, 2012 at 11:09 PM, Doom duman...@gmail.com wrote: Any pointers to a code using NFA / DFA computation model? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the

Re: [algogeeks] c

2011-08-20 Thread pacific :-)
Is const a compiler level construct ? #include stdio.h int main() { const int i = 0; int * p ; p = (int *) i; *p = 2; printf((i,p): %x %x \n,i,p); printf((i,p): %d %d \n,i,*p); } I ran this program and got this output.Can somebody explain ? (i,p): bfc3de6c bfc3de6c (i,p): 0 2 On

Re: [algogeeks] MICROSOFT RESEARCH INTERN

2011-08-16 Thread pacific :-)
Its different. There are separate kind of interviews for both looking for different things. On Tue, Aug 16, 2011 at 5:18 PM, arvind kumar arvindk...@gmail.com wrote: Hi friends Can anyone please tell me about microsoft research intern-the selection process?? Is it the same or is it

Re: [algogeeks]

2011-08-16 Thread pacific :-)
Whats the take-home salary if you work at TCS or infosys ? also work hours expected ? On Mon, Aug 15, 2011 at 12:01 PM, vikas singh shyguy1...@gmail.com wrote: TCS also have COBOL project... TCS has every language based project u can think of. it's your luck whether you get the latest

Re: [algogeeks] reason

2011-08-16 Thread pacific :-)
I believe you are assuming little endian right ? On Mon, Aug 15, 2011 at 2:14 PM, programming love love.for.programm...@gmail.com wrote: The internal representation of array is this: suppose that the address starts from decimal number 10 and integer occupies 2 bytes 10- 0002 ( num 2 in

Re: [algogeeks] c++ multi dimensional arrays

2011-08-16 Thread pacific :-)
In memory arrays are stored in row major ordering.If you dont provide the column size then the system cannot make any access to any of the location in the array. when you actually look for the value at a[4][2] what the system does is that it computes the location as (4 * column_size + 2 ) * (int

Re: [algogeeks] Re: Probability Puzzle

2011-08-16 Thread pacific :-)
I'm little late but I too got 17/18. On Tue, Aug 16, 2011 at 10:47 PM, Jacob Ridley jridley2...@gmail.comwrote: I think there is some ambiguity in the question. (All this time you don't know you were tossing a fair coin or not). 1) Does the above statement mean that the thower don't know

Re: [algogeeks] MS test

2011-08-06 Thread pacific :-)
I believe the answer for fifth one is o(n2) , f(1) + f(2) + ... + f(n/2) ( increment the counter alternatively). Im not very sure. On Sat, Aug 6, 2011 at 10:39 PM, siddharam suresh siddharam@gmail.comwrote: what is *Page segmentation?* Thank you, Siddharam On Sat, Aug 6, 2011 at

[algogeeks] interview questions

2011-08-03 Thread pacific :-)
I couldn't find the solution to this problem please help. Find the *first unique* string from a list of strings in *one pass.* * * *unique : *It occurs only once in the list. *one pass : *you are allowed to traverse the list only once. -- regards, chinna. -- You received this message because

Re: [algogeeks] direct i

2011-07-27 Thread pacific :-)
O(nlogn) 1. precompute the minimum of [ i+1 N] and store in b[i] 2. Now do a binary search for a[i] in b[i+1] in the range of b[i+1. N] On Wed, Jul 27, 2011 at 12:27 PM, salvador_cerinza vishwakarma.ii...@gmail.com wrote: Let say stack S. 1.insert elements in S of A[] from right to

Re: [algogeeks] Re: AMAZON DIRECT-I !!!!!!

2011-07-25 Thread pacific :-)
+1 to the idea of a shared document. A spreadsheet with multiple sheets for different companies should be awesome.But the solution to the problem might as well be discussed in gmail threads. I find it difficult to find the best solution to a problem discussed in gmail threads.Having a

Re: [algogeeks] Re: MS

2011-07-23 Thread pacific :-)
heapsort ? On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma akshatasharm...@gmail.comwrote: better than O(n^2).. On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma akshatasharm...@gmail.com wrote: Given a string *Str of ASCII characters, write the pseudo code to remove the duplicate

Re: [algogeeks] Re: MS

2011-07-23 Thread pacific :-)
By heapsort i meant : After building the min heap(or max heap) ,we extract the top of heap and put it at the end of the array constraint to one condition that if the element already exists at a[heap-size+1] then dont add just discard and continue. O(nlogn) and inplace with no extra memory.But

Re: [algogeeks] Re: Negative index of array

2011-07-20 Thread pacific :-)
This works. code #include iostream #include map using namespace std; int main() { mapint,int a; a[-1] = 0; couta[-1]endl; } /code On Wed, Jul 20, 2011 at 7:50 PM, ankit sambyal ankitsamb...@gmail.comwrote: You can make the following structure : #define MAX 100 typedef struct { int

[algogeeks] interview questoin

2011-07-19 Thread pacific :-)
Find unique string from a list of strings in one pass. -- regards, chinna. -- 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] Re: interview questoin

2011-07-19 Thread pacific :-)
of strings (words) ? There can be many. On Jul 19, 8:31 pm, pacific :-) pacific4...@gmail.com wrote: Find unique string from a list of strings in one pass. -- regards, chinna. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] MS Question

2011-07-07 Thread pacific :-)
Hi, You may look out for plagirism detectors. My approach would be : 1. Hash all the keywords in one file and keep the count. 2. For each keyword in the other file , check if it exists in the hash table , decrement its count. Also increment a counter which represents the similarity between the

Re: [algogeeks] Re: Complexity QuickSort

2011-07-07 Thread pacific :-)
Another question reg. quicksort. If we always find the median in o(n) and use it as the pivot ,will the quicksort by o(nlogn) ( i mean worst case also o(nlogn) )? Since partition is anyway o(n) , im making it o(n) + o(n){for finding median}. On Wed, Jul 6, 2011 at 2:50 AM, Ritesh Srivastava

[algogeeks] Design questions in interviews

2011-07-06 Thread pacific :-)
Hi all , Can someone point to some websites where you can find cs design questions ? Eg. Design a data structure for sparse matrix ? -- regards, chinna. -- 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: Yahoo Question

2011-06-30 Thread pacific :-)
Oh I got it. If ( interview at google) { Map reduce } else if(interview at yahoo) { Hadoop } else { Your personal preference. } On Thu, Jun 30, 2011 at 4:02 AM, bittu shashank7andr...@gmail.com wrote: 1.Use Haddop Map Reduce Framework .Obviously We Need Distributed Algo we will make

Re: [algogeeks] Binary Tree

2011-06-30 Thread pacific :-)
My approach : int FindPath(Node n , sum s ) { FindPath(n-left , s ) || FindPath(n-right , s) || OneOf { a1 = AllSumsFromLeafToRoot( n-left ) } + n-value + Oneof { a2 = AllSumsFromLeafToRoot( n-right ) == s ) } // Use a1 and a2 to find out the actual path } Here all possible

Re: [algogeeks] Re: spoj shlights

2011-06-27 Thread pacific :-)
Can one of you provide some hints in solving this problem ? On Sat, Jun 25, 2011 at 3:34 PM, kartik sachan kartik.sac...@gmail.comwrote: @jitendra that's what i am asking forwhat algo i should implement to get process in 1 sec? -- You received this message because you are

Re: [algogeeks] (OOPS) Composition VS Inheritance

2011-06-26 Thread pacific :-)
The problem with inheritence is that it is compile time(i.e a class A inheriting from class B cannot be modified again) whereas composition can be used to change the objects during runtime(by having a base class pointer we can change the objects runtime). Correct me if i'm wrong. On Sun, Jun

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

2011-06-25 Thread pacific :-)
My approach : 1. Find the median. 1.5 Check if the median is min + (max - min ) / 2. 2. Partition the array into two sub arrays using the partition function of quicksort. 3. Check if the subarrays also satisfy the constraint. Complexity : T(n) = 2 T(n/2) + O(1) :: O(nlogn) On Sat, Jun 25,

Re: [algogeeks] SET IN C

2011-06-24 Thread pacific :-)
Disjoint set data structure. Refer cormen. On Fri, Jun 24, 2011 at 10:36 PM, hary rathor harry.rat...@gmail.comwrote: Can anyone suggest me how to implement a set in c . It means that it should take O(1) in insertion, deletion , finding element -- Harish Pranami Master Of

[algogeeks] Writing good code in interviews

2011-06-24 Thread pacific :-)
Hey all, I want to know a quick list of things (positive and negative) looked in the code written during interviews. I think these are a couple of things to take care. 1. Writing compilable code is definitely good. 2. Variables and methods should indicate their need. Can you guys add more

Re: [algogeeks] Minimum draws for correct labels

2011-06-21 Thread pacific :-)
Is it 4 draws if we were to identify them back ? On Tue, Jun 21, 2011 at 9:22 AM, Navneet Gupta navneetn...@gmail.comwrote: Nice..! On Tue, Jun 21, 2011 at 2:36 AM, oppilas . jatka.oppimi...@gmail.com wrote: Yes. One draw only. As all the box are incorrectly labeled so, box BW willl

Re: [algogeeks] Sum to K problem

2011-06-20 Thread pacific :-)
@vaibhav : Please note that more than two numbers can sum upto k. On Mon, Jun 20, 2011 at 12:21 PM, vaibhav shukla vaibhav200...@gmail.comwrote: sort the array using merge sort : order nlogn take the first element,subtract it with 'k' , then search the result using binary search in rest of

Re: [algogeeks] Minimum Rotations

2011-06-18 Thread pacific :-)
@kk : Your approach looks like o(n^2) and only o(n) is likely to pass TLE. On Fri, Jun 17, 2011 at 5:38 PM, KK kunalkapadi...@gmail.com wrote: http://www.spoj.pl/problems/MINMOVE/ This code is showing TLE after some 20th test case what else can be optimized??? try: import psyco

[algogeeks] spoj problem acode

2011-06-01 Thread pacific :-)
Link : https://www.spoj.pl/problems/ACODE/ 25114 BEAN’, ‘BEAAD’, ‘YAAD’, ‘YAN’, ‘YKD’ ‘BEKD’. How many different decodings?” My soln , but i get TLE.Please help. #include iostream #include cstdio #include vector using namespace std; char * head; int result[5001]; int count(char * a ,int size)

Re: [algogeeks] Admin of Group

2011-05-26 Thread pacific :-)
+1 On Wed, May 25, 2011 at 11:48 PM, anuj agarwal coolbuddy...@gmail.comwrote: Hi, Are there any admins on this group? I recently joined this group and i liked the discussions going on here. But there is a problem which hurts is that unlike other groups which are moderated by certain

Re: [algogeeks] Re: GOOGLE Q

2011-05-19 Thread pacific :-)
If we were given two strings and asked to check if they have the same characters (anagrams) : @ gene : you are sorting them both ,and trying to match. cost : sort the first string + sort the second string + compare i.e k * k + k * k + k .. k is the length of the string. I presume that bubble sort

Re: [algogeeks] Re: Google Q

2011-05-15 Thread pacific :-)
perfect. Thanks for the effort in explanation. On Sun, May 15, 2011 at 12:20 AM, Dave dave_and_da...@juno.com wrote: @Pacific: A balanced binary tree is commonly defined as a binary tree in which the height of the two subtrees of every node never differ by more than 1. Thus, there could

Re: [algogeeks] Re: Google Q

2011-05-14 Thread pacific :-)
Will not a balanced binary tree do the job ? if we will pick the root each time for the median. On Sat, May 14, 2011 at 9:10 PM, Dave dave_and_da...@juno.com wrote: @Ashish: The idea is to keep two heaps, a max-heap of the smallest half of the elements and a min-heap of the largest elements.

Re: [algogeeks] first fit bin packing

2011-05-14 Thread pacific :-)
i think we can use heaps for this problem..bring to the root which has capacity to hold and pick the root each time. If the root cannot accomodate then no other node will be able to accomodate. On Sat, May 14, 2011 at 1:26 AM, MK stardust...@gmail.com wrote: Consider the first fit strategy for

Re: [algogeeks] exon chaining

2011-05-12 Thread pacific :-)
Can you provide example input and output ? On Thu, May 12, 2011 at 9:32 AM, ganesha suresh.iyenga...@gmail.com wrote: Can some one help in finding out the bug in the below code. Input: (left,right,weight) representing intervals Output: maximum weight of non-overlapping intervals #include

Re: [algogeeks]

2011-05-12 Thread pacific :-)
Just a try for : You have a billion urls, where each has a huge page. How to you detect the duplicate documents? 1. Compute a simple hash for each of the document. 2. And for those docs where the hash matches , 3. use a different hash function and go back to step 1.. you might want to stop

Re: [algogeeks] Finding subarray

2011-05-12 Thread pacific :-)
myapproach( set S , sum s ) : Let all elements be set S and we need to find sum , s 1. for each element taken from the set ,e 2. now call the function recursively with myapproach( S - { e } , s - e ) and myapproach( S - {e } , s ) On Mon, Apr 11, 2011 at 3:17 PM, Subhransu

Re: [algogeeks] Re: Need help on Divide and Conquer Algorithm

2011-05-12 Thread pacific :-)
a sort and another traversal would also do the same job in o( nlogn + n ) ?? On Fri, Apr 15, 2011 at 12:49 AM, vishwakarma vishwakarma.ii...@gmail.comwrote: complexity : O(n) + O(nlogn) Sweety wrote: Question :Let A[1..n] be an array of integers. Design an efficient divide and conquer

Re: [algogeeks] Re: Amazon Interview Question

2011-05-10 Thread pacific :-)
My approach : Have a pointer to the start (smallest of the array) of each of the N arrays. Until all pointers reach end of respective arrays : take the smallest value from all of the pointers and compute the difference between the smallest and the current pointers of each of the arrays

Re: [algogeeks] Need the algorithm or idea

2011-05-10 Thread pacific :-)
You may have to use a trie and also the edit distance for this problem. Firstly , walk down the trie as you can keep matching the alphabets. When you encounter a first mismatch , findout the edit distance for the rest of the substring of the input with all of the strings possible from that node

Re: [algogeeks] Output of the code

2011-03-29 Thread pacific :-)
ruby : putsIndia will win the worldcup 2011 On Mon, Mar 28, 2011 at 9:04 PM, shady sinv...@gmail.com wrote: python 2.6 print 'India will win the World Cup 2010' On Mon, Mar 28, 2011 at 8:45 PM, Praveen Kumar praveen97...@gmail.comwrote: Here is the correct program : #includeiostream

Re: [algogeeks] RR Scheduling

2011-03-28 Thread pacific :-)
You can solve this problem using Binary Indexed Trees. (copied from spoj forum) On Mon, Mar 21, 2011 at 3:09 PM, Terence technic@gmail.com wrote: In this problem, sum can be as large as 5*10^9. Try breaking the whole interval into several stages (no more than 2*N), each with a fixed

[algogeeks] Reg. file I/O in unix

2011-03-27 Thread pacific pacific
I have two questions : 1. How many files can a unix process open ( the same file and different files )? 2. How many processes can open the same file (in unix) ? -- regards, chinna. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] Binary Tree to BST

2011-03-25 Thread pacific pacific
I dont see any property of binary tree which u can take advantage of to convert the binary tree to a BST. On Tue, Mar 22, 2011 at 9:31 PM, Decipher ankurseth...@gmail.com wrote: Convert Binary tree to BST in most efficient way ? -- You received this message because you are subscribed to

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread pacific pacific
Does C struct have constructor ? On Fri, Mar 18, 2011 at 12:55 AM, Don dondod...@gmail.com wrote: int n = printf(Hello\n); int main() { } On Mar 17, 8:08 am, himanshu kansal himanshukansal...@gmail.com wrote: is there any way to print hello in c also wdout writing anythng in

Re: [algogeeks] what to learn python or perl

2011-03-15 Thread pacific pacific
I vote for python. On Wed, Mar 16, 2011 at 10:03 AM, kracekumar ramaraju kracethekingma...@gmail.com wrote: Hello Python vs Perl been battle for more than 20 years.Perl is been around 23+ years(not sure,people say 25 years pls check) and python for 21 years. Python would be my choice

Re: [algogeeks] Re: Given an integer n , you have to print all the ways in which n can be represented as sum of positive integers

2011-03-14 Thread pacific pacific
My approach : partition(n) = 1 + partition(n-1) 2+partition(n-2) 3+partition(n-3) .. .. n-1+partition(1) n Assuming 1+2 and 2+1 as different. On Mon, Mar 14, 2011 at 11:53 PM, Aviral Gupta aviral@gmail.com wrote: you can use coin change problem as one of the solutions. Regards

Re: [algogeeks] Re: An interesting question

2011-02-27 Thread pacific pacific
1. do operation on all the values in each column and store it in the first row of each column 2. do operation on all the values in each row and store it in the first column of each row. (when writing at a[0][0] do operation with the value computed at 1.) 3. Now to find out the value at a[i][j]

Re: [algogeeks] GOOG: Design a circular buffer and write the code for the reader and writer routines

2011-02-15 Thread pacific pacific
here is my approach. shared variables : in, out shared memory : buf[N] writer while(1) { while(in+1 % N ==out) { // waiting } buf[in+1]= input; in = in+1 % N } reader while(1) { while(out == in) { // waiting } output = buf[out] out = out+1 % N } On Tue, Feb

Re: [algogeeks] Re: google paper/...plz help..its urgent

2011-01-17 Thread pacific pacific
thanks very much. On Sun, Jan 16, 2011 at 5:04 PM, Lakhan Arya lakhan.a...@gmail.com wrote: @pacific Sets of size 2 can have 2 elements common with set of size greater than 2. for example if set is (1,2) than it is adjacent to sets like (1,2,3) (1,2,4), (1,2,3,4...n) etc. So (1,2

Re: [algogeeks] Re: google paper/...plz help..its urgent

2011-01-16 Thread pacific pacific
@Lakhan Why are you not considering sets of size 2 ? Because two sets of size two cannot have both of the elements as same. On Sat, Jan 15, 2011 at 9:39 PM, Lakhan Arya lakhan.a...@gmail.com wrote: @bittu I don't think answer of 6th question to be a) No. of vertices of degree 0 will be

Re: [algogeeks] Explain anybody solution of Soduo Game is unique or Not......

2011-01-15 Thread pacific pacific
On Sat, Jan 15, 2011 at 6:58 PM, UMESH KUMAR kumar.umesh...@gmail.comwrote: Hello.. Explain and write Algorithm for* Soduo Game* and also describe Solution is unique or Not. I think using a search algorithm like A* would work. if Anybody do you have C/C++ code

Re: [algogeeks] Recursive Function For insertion in BST

2011-01-15 Thread pacific pacific
#include stdio.h #include stdlib.h struct node { int a ; }; int insert(struct node * head ) { struct node * temp; temp= (struct node *) malloc(sizeof(struct node )); printf(temp in function %d \n,temp); head = temp; } int main() { struct node * temp; temp= (struct node *)

Re: [algogeeks] Adobe Question

2011-01-14 Thread pacific pacific
Integers larger than which fit in 32/64 bits. On Thu, Jan 13, 2011 at 8:58 PM, bittu shashank7andr...@gmail.com wrote: 1. 10 test cases for entering 3 values representing sides of a triangle and the program giving output as scalene, isosceles or equilateral--Means At Least 10

Re: [algogeeks] google paper/...plz help..its urgent

2011-01-14 Thread pacific pacific
On Wed, Jan 12, 2011 at 2:44 PM, snehal jain learner@gmail.com wrote: 1. Quick-sort is run on two inputs shown below to sort in ascending order (i) 1,2,3, ….,n (ii) n, n - 1, n - 2, …., 2, 1 Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,

Re: [algogeeks] Re: Amazon Interview - Algorithms

2011-01-14 Thread pacific pacific
At each location if the value is k , find the largest value in the next k elements and jump there. This greedy approach works in 0(n^2) and i believe it works. If not can someone give me a counter example ? On Sat, Jan 15, 2011 at 3:30 AM, Avi Dullu avi.du...@gmail.com wrote: @jammy Even I

Re: [algogeeks] Re: Tejas Networks - Written Test

2011-01-12 Thread pacific pacific
2. can this be done in the following manner ? print the preorder and inorder traversal of the tree and then you can build it back but for binary trees On Tue, Jan 11, 2011 at 1:12 PM, juver++ avpostni...@gmail.com wrote: 1. Any shortest path algorithms on graphs (Dijkstra, Bellman-Ford,

Re: [algogeeks] Re: Amazon Interview - Algorithms

2011-01-12 Thread pacific pacific
doesn't greedy approach work here ? On Sun, Jan 9, 2011 at 8:00 PM, juver++ avpostni...@gmail.com wrote: It doesn't matter how to make transitions: from current position make all necessary moves, or determine all positions from which we can achieve i-th position. So your method is only the

Re: [algogeeks] BT

2011-01-12 Thread pacific pacific
Here is my pseudo code : check( node t1 , node t2 ) { if ( t1-data == t2-data) { return check( t1-left , t2-left ) check(t1-right, t2-right) ; } else { return check(t1-left , t2) || check(t1-right , t2); } } time complexity : o(n) because each node in t1 needs to be visited once.let me

Re: [algogeeks] Google Interview Question

2010-12-27 Thread pacific pacific
here is my approach : Starting from the root node , if root node need to have a 1 ... if root is an and gate : flips = minflips for left child to have value 1 + minflips for the right child to have value 1 else flips = minimum of ( minflips for left child to have value 1 , minflips for

Re: [algogeeks] palindrome

2010-12-22 Thread pacific pacific
On Wed, Dec 22, 2010 at 12:11 PM, mo...@ismu mohan...@gmail.com wrote: if x is a 32 bit number if((x0x)==((x16)0x))) x's bit pattern is a polyndrome @snehal :Do you want to consider binary representation of 5 as 101 or ..0101 ? -- You received this message