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
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
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
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
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
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
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
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
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
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
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
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
+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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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
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
@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
@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
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)
+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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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]
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
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
@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
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
#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 *)
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
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,
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
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,
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
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
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
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
64 matches
Mail list logo