Given a BST, how would you return the nth smallest element. The code had to
cover all the edge cases and was expected to write a logn solution.
--
Umer
--
If I were you, I would have tried to contact my parents, siblings, friends
or people who knew me.
But anyway, the embassy of your country can be helpful.
On Tue, Nov 13, 2012 at 6:52 PM, saurabh arora
saurabharora8...@gmail.comwrote:
u contact indian embassy man..they will help u ,we are also
But how is that going to work for objects?
On Mon, Nov 5, 2012 at 6:43 AM, Ashok Varma verma@gmail.com wrote:
Try this: a = a + b - (b = a); //single line code to swap
On Mon, Nov 5, 2012 at 4:53 AM, Dave dave_and_da...@juno.com wrote:
@Manish: Sure.
a = a + b;
b = a - b;
a = a -
it will encounter a[-1]*
*i dont know if this loop will ever end... very poor solution i will say
*
On Sat, Oct 6, 2012 at 10:00 PM, Umer Farooq the.um...@gmail.com wrote:
Well actually, I've just gone through Dave's code thoroughly and I
believe that his code is most appropriate.
Thanks
/2/12, Umer Farooq the.um...@gmail.com wrote:
why don't we try it from both ends ... something like this:
int i = 0; j = size-1;
while (i != j)
{
if (arr[i] == elem)
return arr[i];
if (arr[j] == elem)
return arr[j];
}
this way, we have eliminated
why don't we try it from both ends ... something like this:
int i = 0; j = size-1;
while (i != j)
{
if (arr[i] == elem)
return arr[i];
if (arr[j] == elem)
return arr[j];
}
this way, we have eliminated half of the comparisons in for loop? What do
you guys say?
On
Rahul,
This might be helpful to you: http://www.geeksforgeeks.org/archives/1068
On Wed, Aug 29, 2012 at 12:29 PM, atul anand atul.87fri...@gmail.comwrote:
just a random guess , i guess rahul is asking this :-
An array which has been rotated cockwise ( say k number of time) . find if
element
A LinkedList is by itself is a BST such that one child node of each node is
null. Do we need a simple BST or height balanced BST?
On Tue, Jul 31, 2012 at 2:39 PM, Ashish Goel ashg...@gmail.com wrote:
how would you do convert sorted doubly linked list to bst using same
nodes as in DLL
Best
range.
On Tue, Jun 19, 2012 at 4:47 AM, Navin Kumar algorithm.i...@gmail.comwrote:
@Umer:
rand(5) + (rand(5)%2): = it will never give 6 because for rand(7) range
will be 0-6.
So better try this: rand(5) + (rand(5)%3).
On Tue, Jun 19, 2012 at 2:45 PM, Umer Farooq the.um...@gmail.comwrote
rand(5) + (rand(5)%2);
On Tue, Jun 19, 2012 at 12:30 PM, Sourabh Singh singhsourab...@gmail.comwrote:
@ sry
condition should be:
if(20*prob = 500/7) :-)
On Tue, Jun 19, 2012 at 12:26 AM, Sourabh Singh
singhsourab...@gmail.comwrote:
@ALL
Given a random number generator say r(5)
algorithm.i...@gmail.comwrote:
@Umer:
rand(5) + (rand(5)%2): = it will never give 6 because for rand(7) range
will be 0-6.
So better try this: rand(5) + (rand(5)%3).
On Tue, Jun 19, 2012 at 2:45 PM, Umer Farooq the.um...@gmail.com wrote:
rand(5) + (rand(5)%2);
On Tue, Jun 19, 2012 at 12:30
What are the specs of the car. Can you please give the answer to the
following clarifying questions:
- How much distance is it suppose to travel without the driver?
- Is it suppose to run on smooth roads only or can it also run on roads
with jumps on it? On what type of road is the car most
cracking interviews is what Microsoft suggests. I'm not sure about the
other one.
On Thu, Jun 7, 2012 at 2:58 PM, sengar.mahi sengar.m...@gmail.com wrote:
http://users.ece.utexas.edu/~adnan/afi-samples.pdf
is dis wat u al r lukin 4??
On Thu, Jun 7, 2012 at 3:01 PM, Abhishek Sharma
, vIGNESH v v.v.07121...@gmail.com wrote:
Hai
Can you brief about the rest of the cases?
On 4 May 2012 01:56, Umer Farooq the.um...@gmail.com wrote:
Hi friends!
I hope that you are doing really good these days.
I submitted my code on interviewstreet.com
The problem statement can be found
Hi everyone,
I was just going through a sample question on interview street and I came
across this question.
Attached file contains the sample question. It is just an advanced version
of towers of hannoi. However, the case00 are quite confusing.
Can anyone please explain us how did they manage
Well, they have specified in the question that you are dealing with
big-data sets. So, recursion won't be a good option I guess.
Can we solve it with dynamic programming technique?
On Mon, Mar 26, 2012 at 2:24 PM, atul anand atul.87fri...@gmail.com wrote:
one way to do it , is say first
of the solution provided in
the given link below or different?
http://www.geeksforgeeks.org/archives/1155
On Tue, Mar 13, 2012 at 11:31 AM, Umer Farooq the.um...@gmail.com wrote:
Yes that is exactly what they wanted. I proposed BFS for this solution.
Anyway, there was another problem that I was able
spanning tree , so you can use prism or
kruskal algo to do the same.
On Mon, Mar 12, 2012 at 3:05 PM, Umer Farooq the.um...@gmail.com
wrote:
Hello friends,
I recently had an onsite MS interview. One of the questions that they
asked was:
- Given a directed graph, write
pointer pointing to any random pointer in the list. The random
pointer can be before or after the current pointer or it can even be at the
same node. Write a piece of code that can produce an exact copy of the
linked list.
On Tue, Mar 13, 2012 at 10:57 AM, Umer Farooq the.um...@gmail.com
Hello friends,
I recently had an onsite MS interview. One of the questions that they asked
was:
- Given a directed graph, write a program that takes root of the graph
and returns root of a tree which comprises of all the nodes of the graph in
the same way as they appeared in the graph
congratz dude! :-)
And best of luck with your future endeavours.
On Wed, Feb 29, 2012 at 11:05 PM, Ravi Ranjan ravi.cool2...@gmail.comwrote:
@all
3 round liye
1.5 hours each only data structure n algorithm n 2 qstns from OS but
ultimately the code for synchronization(a mix situation of
0
On 1/16/12, Ravi Ranjan ravi.cool2...@gmail.com wrote:
An ant moves on a regular grid of squares that are coloured either black or
white.
The ant is always oriented in one of the cardinal directions (left, right,
up or down) and moves from square to adjacent square according to the
what about taking sum of the boundaries of the rectangle and omiting the
boundary with least sum and including the rest of rectangle in the sub-set?
On Mon, Jan 16, 2012 at 8:51 PM, atul anand atul.87fri...@gmail.com wrote:
find cumulative sum of each column.
now for each arr[x][y] = sum of
Here is my solution. Please have a look at it. Any kind of positive
criticism will be highly appreciated.
bool isConnected(int **space, int x, int y)
{
if (x == 0 y == 0)
{
return false;
}
if (y 0)
{
if (space[x][y-1] == 1)
return true;
}
if (x 0)
{
if (space[x-1][y] == 1)
return true;
}
if (x
Are the number of words in one line fixed?
On Sun, Jan 15, 2012 at 1:10 AM, uttam tiwari utmbhu...@gmail.com wrote:
what are the data structures that should be used to make a text editor
where we can perform following tasks:
1. insert text
2. search text
3. delete text
4. automatic line
Is that from a phone interview of MS? :-|
On Fri, Jul 29, 2011 at 2:32 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
Hey everyone , pls tell me how testcases of following:
1. 3 sides of a triangle are taken, output whether its obstuse,
scalene,isosceles..?
2. testcases of a duster...
I
Hi buddy,
nominate me as a group member
my id is: the.um...@gmail.com
On Mon, Jun 13, 2011 at 12:03 AM, shady sinv...@gmail.com wrote:
Vishwakarma deok...@gmail.com
Arpit Sood soodfi...@gmail.com
@kartik could have given your name had you read the post carefully.
Shady.
On Mon, Jun
+1
I really like this group ... but sometimes people get rude and
show prejudice attitude towards me. I hope the admin takes notice of one of
the comment posted above :)
On Mon, Jun 13, 2011 at 12:30 AM, Divye Kapoor divyekap...@gmail.comwrote:
While you're on this - could we have a policy
Where is the admin of this group? These guys are discussing something
completely irrelevant to Algorithms. Could anyone please take a notice of
this in order to maintain the dignity of this group and filter the spam?
On Fri, Jun 10, 2011 at 8:30 PM, coder dumca coder.du...@gmail.com wrote:
so
I'm surprised to see that why are you guys making this problem so complex.
This problem can be solved in two steps only.
1- Convert the given int into string
2- Check if the last character is 0 or 5. // it yes, then return true else
return false
for e.g.
125 (last character is 5 ... therefore
public static isDivisibleByFive(int input)
{
String str_input = String.valueof(input); // convert initial int to string.
if ((str_input.charat(str_input.length()-1) == '5') ||
(str_input.charat(str_input.length()-1) == '0') // check if the last
character is 0 or 5
return true;
return false;
}
I have got a solution for this problem but It is greater than O(n^2).
The idea is to take the edit distance with selected words from dictionary of
all words in english and output the word with min edit distance (An edit
distance is number of insertions, deletions and replacement operations
needed
please send it to me at the.um...@gmail.com
Thanks in advance :)
On Sat, Apr 30, 2011 at 8:41 AM, Manish Kumar manish.iitia...@gmail.comwrote:
please send me this book to my email , thanks manish.iitia...@gmail.com'
On Sat, Apr 30, 2011 at 6:07 AM, Venkat gvr.su...@gmail.com wrote:
Hey
This is an assignment. Ryt? :P
On Thu, Apr 28, 2011 at 1:31 PM, D.N.Vishwakarma@IITR deok...@gmail.comwrote:
*
*
*Just give some time to these problems and solve it. Its sort of
Urgent.And Let me know the Solution.
*
1. Write an algorithm to implement a stack using a two
Yeah, it is very embarrassing to see this kind of post on Algorithms group.
On Thu, Apr 14, 2011 at 6:13 PM, ArPiT BhAtNaGaR
arpitbhatnagarm...@gmail.com wrote:
yeah thats the soln
On Thu, Apr 14, 2011 at 6:12 PM, Kunal Patil kp101...@gmail.com wrote:
@All : Please report it spam and then
nice idea! :)
2011/4/8 Seçkin Can Şahin seckincansa...@gmail.com
I developed a website/facebookapp. I would appreciate it if you could give
feedback about it.
http://apps.facebook.com/wouldloveto/
--
You received this message because you are subscribed to the Google Groups
Algorithm
a pointer to the second node do ,
temp - data = ( temp - next ) - data ;
temp - next = NULL ;
correct me if I am wrong .
On Mon, Apr 4, 2011 at 9:48 PM, Umer Farooq the.um...@gmail.com
wrote:
Hello friends,
The following question has appeared in two top companies of my city
:
in case you are given a pointer to the first node simply do
temp -next = ( temp - next ) - next .
if you are given a pointer to the second node do ,
temp - data = ( temp - next ) - data ;
temp - next = NULL ;
correct me if I am wrong .
On Mon, Apr 4, 2011 at 9:48 PM, Umer Farooq the.um
Anyone here who can answer this question?
On Mon, Apr 4, 2011 at 9:18 PM, Umer Farooq the.um...@gmail.com wrote:
Hello friends,
The following question has appeared in two top companies of my city. I'd
appreciate if anyone is able to answer it.
Given a singly liked list comprising of three
, Apr 4, 2011 at 9:48 PM, Umer Farooq the.um...@gmail.com wrote:
Hello friends,
The following question has appeared in two top companies of my city. I'd
appreciate if anyone is able to answer it.
Given a singly liked list comprising of three nodes
Delete the middle node
Hello friends,
The following question has appeared in two top companies of my city. I'd
appreciate if anyone is able to answer it.
Given a singly liked list comprising of three nodes
Delete the middle node such that:
1- A temp pointer is pointing to the first node
2- A temp pointer is pointing
btw, true is defined in cpp.
On Mon, Mar 28, 2011 at 12:54 PM, Umer Farooq the.um...@gmail.com wrote:
The compiler doesn't want to get killed like poor
manihttp://www.allvoices.com/s/event-8408191
will give error as there is nothing called true defined.
On Sun, Mar 27, 2011 at 10:38 PM, Umer Farooq the.um...@gmail.comwrote:
Hi,
Can anyone tell me the output of the following code?
#include iostream.h
int main()
{
.. if (true)
.. cout Pakistan will win
hhahahahahahahhahaha Bohat aalaa sir! :D caught red-handed :D :P
Ow please tell us the solution, I'm interested in knowing the answer :D
On Sun, Apr 3, 2011 at 9:02 PM, Carl Barton odysseus.ulys...@gmail.comwrote:
Haha
On 3 April 2011 15:28, Arpit Sood soodfi...@gmail.com wrote:
...@gmail.com wrote:
the code will give error as there is nothing called true defined.
On Sun, Mar 27, 2011 at 10:38 PM, Umer Farooq the.um...@gmail.com wrote:
Hi,
Can anyone tell me the output of the following code?
#include iostream.h
int main()
{
.. if (true
This is a great group. Here, we share our knowledge and get to know a lot of
new algorithmic techniques.
On Wed, Apr 6, 2011 at 4:08 PM, Carl Barton odysseus.ulys...@gmail.comwrote:
Yes
On 6 April 2011 11:36, a_SillyGuy ammukumar...@gmail.com wrote:
hi ,
i've recently joined this group in
haha :)
On Wed, Apr 6, 2011 at 4:12 PM, kunal srivastav
kunal.shrivas...@gmail.comwrote:
toughest puzzle ever :P
On Wed, Apr 6, 2011 at 1:27 PM, Akash Agrawal
akash.agrawa...@gmail.comwrote:
throw opposite to gravity...
Regards,
Akash Agrawal
http://tech-queries.blogspot.com/
On
Hi,
Can anyone tell me the output of the following code?
#include iostream.h
int main()
{
.. if (true)
.. cout Pakistan will win the WorldCup 2011\n;
return 0;
}
--
Umer
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
++
On Tue, Mar 22, 2011 at 9:39 PM, Saravanan T mail2sarava...@gmail.comwrote:
++
On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri anu.anurag@gmail.comwrote:
and me too :)
On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra mishra00...@gmail.comwrote:
count me too
On Tue, Mar 22, 2011
theoretical
- Principles of Concurrent and Distributed Programming by M.Ben Ari
On Fri, Feb 18, 2011 at 3:07 PM, Umer Farooq the.um...@gmail.com wrote:
Hello,
Can anyone suggest me a good book for parallel algorithms?
--
Umer
--
You received this message because you are subscribed to the Google
Hash.
On Wed, Feb 16, 2011 at 9:45 PM, yv paramesh yv.param...@gmail.com wrote:
build a tree
On Wed, Feb 16, 2011 at 10:10 PM, vaibhav agrawal agrvaib...@gmail.com
wrote:
Hash, SortedSet
On Wed, Feb 16, 2011 at 9:58 PM, bittu shashank7andr...@gmail.com
wrote:
Given a set of words
.
Regards,
On Wed, Feb 9, 2011 at 3:37 PM, Umer Farooq the.um...@gmail.com wrote:
Hello,
I am new user of UVa website and I'm having problems in submitting the
solution. Can anyone tell me
1- How do we take the input? via input file? command line arguments?
2- How do we print the output
Hello,
I am new user of UVa website and I'm having problems in submitting the
solution. Can anyone tell me
1- How do we take the input? via input file? command line arguments?
2- How do we print the output? In an output.txt file? on Console?
3- Do we have insert the package statement? (if we are
Well, MS is way better in this regard. They talk so politely and take only a
couple of weeks to send a message for further interview :-)
On Sun, Feb 6, 2011 at 9:15 PM, shubham singh
shubhamsisodia0...@gmail.comwrote:
i applied for intern and get reply within a month.
--
You received this
Hello,
I have applied for fresh grad posts in Google. I have filled up their forms
and uploaded the resume. Can anyone tell me how long do they take to process
the resume and how long should I wait?
--
Umer
--
You received this message because you are subscribed to the Google Groups
Dude!
There must be something wrong with your compilers!!
It isn't even accepting a hello world program. it's giving a compilation
error on that as well :-/
On Wed, Feb 2, 2011 at 9:49 PM, Umer Farooq the.um...@gmail.com wrote:
How am I suppose to provide inputs? Input file names??
On Wed
How am I suppose to provide inputs? Input file names??
On Wed, Feb 2, 2011 at 1:25 PM, Nikhil Agarwal nikhil.bhoja...@gmail.comwrote:
On Tue, Feb 1, 2011 at 7:42 PM, Umer Farooq the.um...@gmail.com wrote:
Hello,
it's really nice to see such a world wide online programming competition
Hello,
it's really nice to see such a world wide online programming competition
being organized after Google CJ. I have got a three questions
1- Can we use Dev C++ (which we have been using on windows platform).
If we are allowed to use dev C++, then do we have to submit .cpp files only
or .cpp
Hi there, can you share some of the Microsoft phone interview questions.?
On Thu, Jan 27, 2011 at 6:47 AM, Ankit Babbar ankitbabba...@gmail.comwrote:
Hey all...Can anyone provide me with the recent (/most common) written test
questions(or links ) of Microsoft IDC and Microsoft IT SDE
We can also use jagged arrays for this purpose
int[][] symmetric_matrix = new int[size][];
for (int i=0; i size; i++)
...symmetric_matrix[i]=new int[max_diagonal/(size)];
On Wed, Jan 12, 2011 at 9:30 AM, Sathaiah Dontula don.sat...@gmail.comwrote:
1 + 2 + + n ( max diagonal) = n (
Well, u can use List of Lists. The List would contain head nodes of all the
lists and each list would contain a row. The length of every list will be 1
greater than the next of it's next list.
In this way:
The tail of list would contain a diagonal element which
L
L1 1
L2 4 2
L3 4 3
There might be some error in calculating the value of some variable(s) which
might be used to retrieve elements in some arrays/maintaining stack/linked
list or any other data structure that uses the value of that variable to
retrieve information from memory.
Carefully checking the values of
Can you elaborate the problem a little more? It has been stated in vague
manner.
On Fri, Dec 31, 2010 at 10:39 AM, sara yourfriend.sa...@gmail.com wrote:
I Should Write A Recursive Program Of Extended Hanoi Tower. We Have
A,B,C Like Before But There Is 2n Button. Odd Buttons In A And Even
creating a bst would require extra space. You can do this with an array of
char dude.
On Sun, Sep 19, 2010 at 3:31 PM, LG JAYARAM . lgj...@gmail.com wrote:
hi buddy ...Im clear with the ideahereby I share the concept...
wat exactly need to be done to solve this task isbetter create a
here's the java implementation
package removeduplicates;
import java.io.*;
/**
*
* @author UmerFarooq
*/
public class Main {
/**
* @param args the command line arguments
*/
public static char[] input;
public static void remDep(int i, int j)
{
if (j0)
btw, if u rn't suppose to use any extra space, then u should be going for
iterative solution; since recursion uses extra space by default.
On Sat, Sep 18, 2010 at 11:33 PM, Umer Farooq the.um...@gmail.com wrote:
here's the java implementation
package removeduplicates;
import java.io
Can anyone explain me how graham scan algorithm for finding the convex hull
works ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
How much time to u have? If you have got more than a month and u don't know
any language; then I'll suggest you to learn a programming language like C++
or Java.
In my opinion, C++ is the best language for these kind of problems :)
Regards
Umer.
On Wed, Mar 31, 2010 at 5:12 PM, naga vinod kumar
and it has cycle. Both N1 and N2 will keep
traversing within the cycle.
On Sun, Mar 28, 2010 at 9:56 PM, Umer Farooq the.um...@gmail.com wrote:
I'll appreciate comments on the solution proposed by me. It works the
following way:
take two pointers, N1 and N2 pointing on the head
insert the elements in the list, the elements of the tree visited by inorder
traversal
On Sun, Mar 28, 2010 at 11:13 AM, Piyush Verma 114piy...@gmail.com wrote:
how to convert a BST into a sorted doubly linked list.
is there any solution of this question.
--
You received this message
Thanks for lettimg me know that. Although I have used this kinda thingy in
solving a lot of problems; but, I never knew that it is called a trie.
On Thu, Mar 4, 2010 at 8:08 PM, Chakravarthi Muppalla
chakri...@gmail.comwrote:
@Umer
'categorize the words into 26 categories depending on the
I can't get how will u manipulate the trie DS. u'll have to look back and
see if the word already exists in the list. this will be an extra overhead.
I have thought of another algorithm. Here is an abstract explanation:
The node used will be like this
struct Word {
.char *_word;
72 matches
Mail list logo