@Teja Bala
U dont need the last line for a[0][0]
else code will be wrong
conside
0 0 0 0 1
0 0 0 0 0
0 1 0 0 0
0 0 0 1 0
Regards
On Sun, Sep 11, 2011 at 11:56 PM, teja bala pawanjalsa.t...@gmail.comwrote:
//pseudo code dis will work for sure.
for(i=0;irow_count;i++)
) = 1;
if (row0has1)
for (j = 0; j n; j++) M(0,j) = 1;
if (col0has1)
for (i = 0; i n; i++) M(i,0) = 1;
Maybe there's a slicker way, but this is O(mn)
On Sep 26, 9:46 pm, Ankur Garg ankurga...@gmail.com wrote:
Saw this question in one of the algo communities.
Amazon telephonic interview
You are given 2 log files each having 1 billion entries and each entry has a
unique customer id.You need to print the records in two files which are
common.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
void sort012(int a[],int n){
int i = 0, s = 0, last = n-1;
while(i=last){
if(a[i] == 0 i!=s)
{
swap(a[i], a[s]);
s++;
}
else if(a[i] == 2 i!=last)
{
swap(a[i], a[last]);
last--;
}
else
i++;
}
}
On Sat, Sep 24, 2011 at 5:13 PM,
Deoki nandan
In MCQ there were options as well ?? is it ?
Also were questions in MCQ only from coding or OOPS,DBMS,OS etc also are
part of those ?
Regards
On Sat, Sep 24, 2011 at 6:13 PM, Aamir Khan ak4u2...@gmail.com wrote:
@shiv : Correct Answer should be : 5C3 X 5 X 4 X3 = 600
Hi Frnds
Can anybody suggest me some questions typically asked on Graphs .
Couldnt find much in the internet
If some one can share link or few questions on Graphs it will be really
helpful
Thanks in Advance
Ankur
--
You received this message because you are subscribed to the Google Groups
.
Find the minimal spanning tree of a weighted, connected graph.
On Sep 22, 2:03 pm, Ankur Garg ankurga...@gmail.com wrote:
Hi Frnds
Can anybody suggest me some questions typically asked on Graphs .
Couldnt find much in the internet
If some one can share link or few questions on Graphs
Q9 - 1 *logn for getting the minimum element ..Normal heap Sort procedure
Q3 - n+logn-2 comparisions so 51 -2 + log 51
Regards
Ankur
On Mon, Sep 19, 2011 at 7:59 PM, Ashima . ashima.b...@gmail.com wrote:
m getting result in 95 matches
Ashima
M.Sc.(Tech)Information Systems
4th year
Yes...You cant use suffix trees here...Forget Coding...can anybody even
explain the algo as to how suffix trees or tries can be used here ?
On Tue, Sep 20, 2011 at 12:45 AM, pooja pooja27tan...@gmail.com wrote:
exactly.. to implement suffix tree was out f my reach atleast during
the test.
nice find bhanu..though i didnt get much :P on first read :D :D
On Tue, Sep 20, 2011 at 4:34 AM, Bhanu Kishore bhanukishor...@gmail.comwrote:
See this algorithm:
http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm
--
You received this message because you are
In a matrix of characters, find an string. String can be in any way (all 8
neighbours to be considered)
like find Microsoft in below matrix.
A
C
P
*R
*C*
*X
*S
**O
*P
*C*
V
*O*
V
N
*I*
W
G
*F
**M
*N
Q
A
*T*
I
T
*Any Ideas How to Solve/Approach this problem ?*
--
You received this message
Some typos in my solution :(
Use a Max heap..
first take the first 10 stations and build a* Max *heap O(10)..Heap contains
distance between 2 stations . Initial Heap will contain 10 *minimum
*distances
with maximum of those at the top . Now 11 th comes u compare with the root
of the heap . If
pushed element will have the greatest priority and the
element pushed first will have
lowest priority.
For queue:- keep decrementing the priority of each inserted element.
On Sep 13, 1:45 am, Ankur Garg ankurga...@gmail.com wrote:
How to Implement a Queue with a Priority Queue
Similarly how
^+1
On Mon, Sep 12, 2011 at 11:41 PM, Ankuj Gupta ankuj2...@gmail.com wrote:
Is there any restriction on the input like they are in given range ?
On Sep 11, 11:10 pm, Neha Singh neha.ndelhi.1...@gmail.com wrote:
You are given an array that contains integers. The integers content is
such
given an array of size N containing only 0s and 1s return the length of the
maximum sub array containing equal number of 0s and 1s
Give a O(n) solution
It has been asked before in this forum but no one has given a proper
solution so m asking again
May be we need DP here..But what will be the
This solution is not in O(n) time :(
Unfortunately interviewer wants O(n) .
On Sun, Sep 11, 2011 at 4:01 PM, Kunal Patil kp101...@gmail.com wrote:
@Brijesh: +1
On Sun, Sep 11, 2011 at 2:14 PM, Brijesh brijeshupadhyay...@gmail.comwrote:
This is the fastest way I can think of to do this,
of intervals.
Assuming n means number of elements in the original array
There are O(n^2) possible intervals, how can you print them in O(n) ???
On Sun, Sep 11, 2011 at 4:20 PM, Ankur Garg ankurga...@gmail.com wrote:
This solution is not in O(n) time :(
Unfortunately interviewer wants O(n
If its a BST then the rightmost element will be the maximum followed by root
and left node
So we can use recursion
Working Code
struct node* findKthLargest(node* root, int k)
{
if(root==NULL){
return NULL;
}
struct node* temp;
temp=findKthLargest(root-right,k);
k--;
if(k==0)
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
Can anybody explain logic ?
--
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
, Ankur Garg ankurga...@gmail.com wrote:
Hi
PFA my resume for the below position
Regards
Ankur
On Tue, Aug 30, 2011 at 1:00 AM, katie williams
katiewilliams...@gmail.com wrote:
*URGENT- Software engineers - Java / J2ee!! MAX $45/Hr...Need LOCALS
(Face to Face Required)*
-After TS Second
@techcoder
Making an array of 32768 or INT_MAX will make ur compiler cry
Also ur case doesnt handle the scenario where square root is a decimal
number
On Tue, Aug 30, 2011 at 1:35 PM, tech coder techcoderonw...@gmail.comwrote:
the sqrt of 32 bit number can't be more than 16 bits.
have an
Hi
PFA my resume for the below position
Regards
Ankur
On Tue, Aug 30, 2011 at 1:00 AM, katie williams
katiewilliams...@gmail.comwrote:
*URGENT- Software engineers - Java / J2ee!! MAX $45/Hr...Need LOCALS (Face
to Face Required)*
-After TS Second round of interviews will be F2F! This
cant we just count the no of nodes in each level and compare them with the
second one..
if the numbers are same trees can be said to be isomorphic
On Sun, Aug 28, 2011 at 3:54 AM, Dave dave_and_da...@juno.com wrote:
@Bugaboo: Use recursion. Assuming
struct tree_node {
tree_node *left;
Daves solution looks cool to me...shud work :)
Nice one Dave :)
Regards
Ankur
On Sun, Aug 28, 2011 at 4:08 PM, Ankur Garg ankurga...@gmail.com wrote:
cant we just count the no of nodes in each level and compare them with the
second one..
if the numbers are same trees can be said
You are given n no. of lines in form of Ax + By = C, basically you are given
A[i], b[i] and C[i] for line i.
Lines are given in a way such that 0 = x[i] = 1 and y[i] y[i+1] for same
X.
Also, one point (x,y) is given too. Find out the two closest lines to the
point such that the point is between
Hi
The ques explicitly said the elements are in pairs ...But the one given by
sanjay has more than 2 2's ...that question cant be done using bsearch then
On Wed, Aug 24, 2011 at 6:21 PM, Sanjay Rajpal srn...@gmail.com wrote:
yes this is the only one till now, but i think we can do better also.
Hi
Suppose there is a program
int main(){
printf(%t,main());
sleep(1000);
return 0;
}
The above program is run from 100 different windows
What will be the output
Will there be any pattern
Regards
Ankur
--
You received this message because you are subscribed to the Google Groups
It means when u call that func u get the next word in the document
Regards
Ankur
On Wed, Aug 24, 2011 at 6:59 PM, vikas vikas.rastogi2...@gmail.com wrote:
what do you mean by a function for finding the next word is given ?
On Aug 22, 1:56 am, Ankur Garg ankurga...@gmail.com wrote:
Question
Both of these methods will require extra ,memory
On Wed, Aug 24, 2011 at 9:42 PM, Anup Ghatage ghat...@gmail.com wrote:
How about this,
We compare the first character with every character except the characters
in the word itself, if there is a hit, it might be a word which is a
duplicate.
:
@ankur:
i think its error..l value required
On Wed, Aug 24, 2011 at 11:18 PM, Ankur Garg ankurga...@gmail.com wrote:
Hi
Suppose there is a program
int main(){
printf(%t,main());
sleep(1000);
return 0;
}
The above program is run from 100 different windows
What
http://en.wikipedia.org/wiki/XOR_linked_list
Check this...will be handy
On Thu, Aug 25, 2011 at 2:12 AM, Mohit kumar lal kumarmohit...@gmail.comwrote:
it might cause STACK OVERFLOW for larger size of lists.
On Thu, Aug 25, 2011 at 2:04 AM, Abhishek
mailatabhishekgu...@gmail.comwrote:
in
Find the middle of the stack..(Time complexity should be minimum)
Stack is not implemented as Linked List ...u have normal stack with push,pop
and top
How to do this ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Also to add,
If you post profile in their portal no reply comes...How to apply ...can any
one here refer my candidature for Mentor Graphics ..I have 2 yrs work ex
working with IBM ISL
Regards
Ankur
On Mon, Aug 22, 2011 at 7:23 PM, Mangal Dass mangaldass1...@gmail.comwrote:
Anybody pls tell me
@Harsha
Bro I am unable to read ur blog ..It says this
http://harshal-theone.blogspot.com/
It doesn't look like you have been invited to read this blog. If you think
this is a mistake, you might want to contact the blog author and request an
invitation.
Is there anything I need to do to view
Question-- Given a document containing some words ...and a function
for finding the next word is given .design a code which efficiently search
the word and find occurrence of it in given document .
-which data structure will be used?
One of my frnds was saying its not recommended to be Used
Please suggest
--
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
U can use selection Algorithm to achieve the same ...it has got expected
running time complexity as O(n) ...Read Wikipedia to see the proper
implementation..
Just some tweak with Quick Sort ..Also there is one method median of medians
one which has worst case complexity as O(n)
Regards
Ankur
Define a data structure , using extra memory/space , such that :
Insert(int a)
Delete(int a)
isPresent(int a)
get(int a)
All above operations on the defined data structure take O(1) , i.e. constant
time.
Any suggestions /solutions for this problem
Regards
Ankur
--
You received this
Can u provide a bit detail bro !!
On Thu, Aug 18, 2011 at 8:04 AM, sagar pareek sagarpar...@gmail.com wrote:
Hashing
:)
On Thu, Aug 18, 2011 at 5:30 PM, Ankur Garg ankurga...@gmail.com wrote:
Define a data structure , using extra memory/space , such that :
Insert(int a)
Delete(int
Write test cases for WordPad,Notepad
In general while writing test cases for problems what parameters should one
Consider. MS has a habit of asking these sort of questions on a regular
basis
Please help as i cant think much on how to attack ques like these
Regards
Ankur
--
You received this
I found it a bit tough..Can anyone suggest code for it
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
base-n digits, each of O(n), so the overall order will be O(n).
On Aug 14, 10:08 am, Ankur Garg ankurga...@gmail.com wrote:
This is one question from Coreman
3rd Edition -
8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time
Any ideas how to do this in O(n)
--
You
This is one question from Coreman
3rd Edition -
8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time
Any ideas how to do this in 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
Where ever u have allocated dynamic memory that qualifies to be a culprit
for causing memory leak ...Scan through the code if the memory block has
been deallocated or not ...
Regards
Ankur
On Sun, Aug 14, 2011 at 6:03 PM, SAMMM somnath.nit...@gmail.com wrote:
How to detect in which line the
@Dave
How is the complexity O(n^2logn) .. Can you please tell
I believe there cant be solution better than O(n^2) unless u use FFT which
again is out of scope , at least for me :)
Regards
Ankur
2011/8/11 Samba Ganapavarapu sambasiv...@gmail.com
Can we find any alg. which runs faster than
+1..me too need answers for this
On Fri, Aug 12, 2011 at 11:39 AM, MAC macatad...@gmail.com wrote:
if someone can share one good solution , it would really help me. I am
unable to form the answer to these questions
--mac
On Fri, Aug 12, 2011 at 1:15 PM, MAC macatad...@gmail.com wrote:
In the code snippet that you have written u r changing the value of the
variable d which has been defined as auto variable (int d)
Now when u declare
const int *const ptr = d;
that means both the ptr and int are constant and u cant change either so u
cant deference ptr to some other int value
How much thought work pays..Can any1 tell ?
On Mon, Aug 8, 2011 at 2:48 PM, vaibhav shukla vaibhav200...@gmail.comwrote:
@raj : its about to come to our campus too..questions hv been uploaded
already in grp. Do send the questions which they ask please
On Tue, Aug 9, 2011 at 12:09 AM, raj
I can think of this solution
Put first elements in a max heap ..O(10)
Now take 11 th element ..compare it with root of this max heap ..If less
than root ignore ..else remove root and call max-heapify and put this
element in right place
Similarly do this for rest
Complexity will be n+nlogk
The questions in the link are quite decent...Is the toughness level of
Amazon test same or more ?
On Sat, Aug 6, 2011 at 11:47 AM, shady sinv...@gmail.com wrote:
@nivedita this is for job right ?
On Sat, Aug 6, 2011 at 9:14 PM, nivedita arora
vivaciousnived...@gmail.com wrote:
no online
@Yasir
MCQ are of which types ???
Regards
Ankur Garg
On Sat, Aug 6, 2011 at 4:45 PM, Yasir yasir@gmail.com wrote:
Earlier they had telephonic interview as first round but now this
online exam has become initial screening test.
Based on ur online test's performance they call for phonic
@Yasir
Thanks bro :)
On Sat, Aug 6, 2011 at 7:13 PM, Yasir yasir@gmail.com wrote:
Same as of DS Algo in GATE exam.
http://geeksforgeeks.org/?cat=66
On Aug 7, 2:29 am, Ankur Garg ankurga...@gmail.com wrote:
@Yasir
MCQ are of which types ???
Regards
Ankur Garg
Why cant structures be declared or defined in C but can be done in C++ ?
What is the reason for this ?
--
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
be declared.classes are not declared!!!
On Fri, Aug 5, 2011 at 12:13 AM, Dipankar Patro dip10c...@gmail.comwrote:
Structures can very well be declared in C:
struct student{
char name[20];
int roll;
}s1;
Are you talking about Classes?
On 4 August 2011 23:51, Ankur Garg
a class and vice-verse ...
if u dont believe then just try it or google it...
so as C is not object oriented hence we cant do things in it as we do in
C++
On Fri, Aug 5, 2011 at 12:46 AM, Ankur Garg ankurga...@gmail.com wrote:
sorry guys cudnt put question properly :P..my bad
Hi All,
Anyone who recently appeared for Oracle Interview .
What all topics,subjects do they ask ?
Regards
Ankur
--
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
Q1 can be looked as rotated sorted array...check whether the no is less or
greater than kth element ..if greater search using binary search with low =0
high k-1 and if less earch in right with low=k+1 high =n;
q2) Dont know :(
On Wed, Aug 3, 2011 at 3:44 PM, Dave dave_and_da...@juno.com wrote:
Dave's solution looks gud to me :)
On Wed, Aug 3, 2011 at 3:52 PM, Ankur Garg ankurga...@gmail.com wrote:
Q1 can be looked as rotated sorted array...check whether the no is less or
greater than kth element ..if greater search using binary search with low =0
high k-1 and if less earch in right
for 1 st question though it will give
answer but not optimized one :)
On Wed, Aug 3, 2011 at 4:02 PM, amit karmakar amit.codenam...@gmail.comwrote:
I think for question 1, the value of k is not provided, right?
On Aug 4, 12:53 am, Ankur Garg ankurga...@gmail.com wrote:
Dave's solution looks gud
Is this to tell people that U got an Intern at Google :P
Another Wannabe here ...arg
On Tue, Aug 2, 2011 at 5:17 PM, Anil Arya anilarya...@gmail.com wrote:
I think the right answer is Balaguruswamy.
If am wrong ..Plzz correct me
On Wed, Aug 3, 2011 at 2:12 AM, sagar pareek
Has anybody given Myantra Iview recently
I have an interview coming up
Please share ques if you have
Regards
Ankur
--
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
No one has it ?
On Sat, Jul 30, 2011 at 7:52 PM, Ankur Garg ankurga...@gmail.com wrote:
Has anybody given Myantra Iview recently
I have an interview coming up
Please share ques if you have
Regards
Ankur
--
You received this message because you are subscribed to the Google Groups
, Kunal Patil kp101...@gmail.com wrote:
@Ankur Garg: Nice explanation at the link given by u...
On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg ankurga...@gmail.comwrote:
Check this
http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html
On Tue, Jul 26, 2011 at 9:41 PM, Vishal
Hi
Dont u think the subsets will also be
{2,1}
{3,1}
{3,2}
{4,1}
{4,2}
{4,3}
On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:
Given an array of size n, print all the possible subset of array of
size k.
eg:-
input:
a[]={1,2,3,4}, k = 2
output:
1,2
1,3
1,4
2,3
+1
Me too looking out for the same :(
On Tue, Jul 26, 2011 at 7:10 PM, Saravanan T mail2sarava...@gmail.comwrote:
+1
Pls send to my email id as well..
On Tue, Jul 26, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.com
wrote:
Anyone having the Google Resume book pdf?
--
You
Hey Guys
Can we use KMP Algorithm here to generate permutations...May be a bit
modification is req
On Tue, Jul 26, 2011 at 9:07 PM, keyan karthi keyankarthi1...@gmail.comwrote:
oops .. permutation pardon me guys !!!
On 7/26/11, keyan karthi keyankarthi1...@gmail.com wrote:
@kavitha:
Check this
http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html
On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki vishaltha...@gmail.comwrote:
Here is the working code..
#include stdio.h
#include stdlib.h
int a[] = {1,2,3,4,5};
#define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
Use KMP algorithm
On Mon, Jul 25, 2011 at 4:47 PM, nitesh abhishek.khattr...@gmail.comwrote:
Given a string, give an algo to find the number of occurrences of a
particular pattern
Eg:
Input: bellatbellfordbelly
Find the number of occurrences of pattern(or substring) bell in it..
--
You
Do take a look at this also
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#cite_note-7
Source code to list all prime numbers till number n
#includeiostream
#includealgorithm
#define bool int
using namespace std;
int main(){
int n;
cinn;
int i,j;
bool primeValues[1000]={0};
9 for how much exp ??
On Sat, Jul 23, 2011 at 3:26 PM, sush57 sushaant...@gmail.com wrote:
9...
On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
Whats the CTC ???
On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com wrote:
can anyone suggest interview
kool man ...Whr to apply for exp people ??
Can you share some link and all
is company Chronos?
On Sat, Jul 23, 2011 at 3:33 PM, sush57 sushaant...@gmail.com wrote:
fresher
On Jul 23, 3:02 pm, Ankur Garg ankurga...@gmail.com wrote:
9 for how much exp ??
On Sat, Jul 23, 2011 at 3:26
http://chronus.com/
Is this the site of the company ?
On Sat, Jul 23, 2011 at 3:45 PM, Ankur Garg ankurga...@gmail.com wrote:
kool man ...Whr to apply for exp people ??
Can you share some link and all
is company Chronos?
On Sat, Jul 23, 2011 at 3:33 PM, sush57 sushaant...@gmail.com
101 - 173 of 173 matches
Mail list logo