[prefixCount++] = String(a[i][j];
}
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Wed, Jul 4, 2012 at 12:22 PM, Decipher ankurseth...@gmail.com wrote:
Find the next higher number in set of permutations of a given number
--
You received
Q1) Given a newspaper and a set of ‘l’ words, give an efficient algorithm
to find the ‘l’ words in the newspaper.
Q2) Find the next higher number in set of permutations of a given number.
Q3) Given preorder of a BST, find if each non-leaf node has just one child
or not. To be done in linear
Vindhya - Navin is right because in case of BST, if you sort the preorder
array you will get inorder array. This means you already have information
about the inorder, if you given preorder/postorder/levelorder.
--
You received this message because you are subscribed to the Google Groups
Hi,
I need code to convert Regular Expression to NFA and then check whether it
accepts an input string or not.
Please help !!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Also, goto cannot jump across functions , which imposes a major setback
for its use in exception handling
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
I think you should start with DS in C by Tenanbaum. If you find it tough,
then try some Indian DS books like DS in depth by Srivastva.
After that you should try questions from Crack The Interview website or
GeeksForGeeks tutorials and read advanced algos from :
Introduction To
Does anybody has its ebook ? Please upload it
--
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/-/AETPnqJps7AJ.
To post to this group, send email to
First read a file of English words, one word per line, and then
another file, with a set of (possibly space separated) letters,
one set per line.
For each set in file 2, write out all valid anagrams of those
letters, from the words given in file 1.
For instance, if the letters in some
AM, atul anand atul.87fri...@gmail.comwrote:
find cumulative sum row[0]
find cumulative sum of col[0]
after this following recurrence will solve the problem.
start from mat[1][1]
mat[i][j]=mat[i][j]+min( mat[i][j-1] , mat[i-1][j] )
On Sun, Jun 3, 2012 at 7:30 PM, Decipher ankurseth
Q) In the 5 by 5 matrix below, the minimal path sum from the top left to
the bottom right, by moving left, right, up, and down, is indicated in bold
red and is equal to 2297.
*131*
673
*234*
*103*
*18*
*201*
*96*
*342*
965
*150*
630
803
746
*422*
*111*
Given N files on disk of sizes 16 GB, containing integers in sorted
order, one integer per line. Create a single file with all the integers in
sorted order.
Usage : sortEM (file1, file2)
file1 has list of input files, one name per line
file2 is the name of file into which the output has to be
Q1) Yes, as per my friend the only interface is that function. But how will
you traverse the matrix because if : BADCAT is one row then there are two
words BAD and CAT and you have to find both and it could be DAB and TAC
also ?
Q2) What will be the complexity when state machine is used ?
--
This was asked from my friend in January for MTS profile.
Q1) Given a matrix with letters in each square and you have to find words
which are there in the dictionary (like Children's Crosswords). You have
been given a function which outputs 1 if the given word is in the
dictionary. The word
I need some help in understanding how padding works ??
Please answer the following questions with proper explanations..
struct mystruct1
{
char a;
int b;
short c;
long d;
};
struct mystruct2
{
char a;
short b;
char c;
long d;
};
What's the sizeof above 2 structures and why ??
This question was asked by Facebook during their 2 hour online exam (Only 1
question in 2 hour as per my junior) in DCE.
Given a list of words wordlist on 1st line (no of words = 100) and a
string qstr of len = 1 million on 2nd line, print the index at qstr where
a continuous substring exists
A given sorted array is rotated unknown number of times , write a C/C++ code
to find an element in the sorted array in O(log n) time .
I know the solution to this problem is through binary search , but don't
know the exact solution . Please help !!
--
You received this message because you are
Q1) A sorted array is rotated unknown number of times , write an algorithm
to search an element in this rotated array in O(log n) .
Hint : Modify binary search
Q2) Write an algorithm to traverse a rectangular matrix spirally.
--
You received this message because you are subscribed to the
Q1) What does the compiler does if I declare a base class VIRTUAL ??
Q2) In the below test code ,
class A : public B, public C
{
};
The order of constructor invocation is :
B
C
A
but if C is virtual base class the it changes to :
C
B
A
Why ??
Q3) Write a macro that swaps any data given to it
@vikas - As i said earlier think in 3D . The correct answer is (sqrt(3) -
1)R/(sqrt(3) + 1) = r
Using 3D coordinate geometry if (R,R,R) and (r,r,r) are the coordinates of
center of large and small sphere . Then , make distance formula for centers
of sphere in 3D = (R+r)
*Now don't ask
Sticks length not required . Think in coordinate geometry in 3D .
Also for Checkin and Checkout question - Make a flag array associated with
each element of the list and initialize the every element to *{1}* and
traverse the checkout list (checkout[i]) . Now do binary search for an entry
in
Yup array is sorted first then rotated !!!
--
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/-/1CYpZg2TLzYJ.
To post to this group, send email to
@vikas - Can u post ur answer using segment trees ??
--
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/-/ssVg6dOuXiUJ.
To post to this group, send email to
Can anyone tell me the interview procedure of Mentor Graphics along with
some interview questions ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Hi,
This is my Adobe interview experience for freshers :
*Written Test:*
Engineering – 45 Minutes - Data Structures, Algorithms,
Operating Systems
C/C++ – 45 Minutes - C/C++ Fundamentals Coding
Aptitude– 45 Minutes –
--
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/-/TSCBDch6GdYJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
Write a macro to swap integers , floating point , chars and pointers ?
--
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/-/hYyEh3PaS_QJ.
To post to this group,
Hi,
I am from 2011 batch and according to my juniors Directi came to our campus
and hired a person named Nikhil from IT . Try to get in touch with him or
contact anyone from COE/IT who is currently in DCE .
--
You received this message because you are subscribed to the Google Groups
Also there is a person named Mukesh Gupta or nickname scholar in this group
from DCE (2011 batch). He was rejected in last round . Try to get in touch
with him .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the
class Base
{
public :
virtual void show()
{
cout\n Base ;
}
};
class Derived : public Base
{
private :
void show()
{
cout\n Derived ;
}
};
int main()
{
Base
Completely agree with maxpayne . Follow this website : www.parashift.com
(from the author of C++ FAQs)
And effective C++ is available at freebookspot.com
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web
I don't know the answer since my friend who had given the interview was not
able to answer the questions . But remember its a SPHERE so think in 3-D
rather then 2-D and also please give the logic behind your answer .
--
You received this message because you are subscribed to the Google Groups
Annotated C++ Reference Manual - Most of the pages are available on
books.google.com
Test your C Skills - freebookspot.com
www.parashift.com - Extremely good C++ questions with answers
www.carerride.com - Some good online tests on C++ (will be useful for
Written tests)
--
You received this
There is a river and there are n number of steps between two banks of the
river to cross the river.
A frog wants to cross the river with the condition that he can jump max one
step. Find the number of ways he can cross the river?
For e.g. if there are 3 steps in between, frog can go from
How did you know that ?
--
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/-/GMle2k9i73wJ.
To post to this group, send email to algogeeks@googlegroups.com.
To
I applied to Texas Instruments last year for software profile and these are
some of the questions that were asked in interview round :
1) How to find least common ancestor of two nodes in a tree ?
2) Some questions on virtual table and vptr ? Is Vtable created per class or
per object ?
3) Some
Q1) How to find factorial of a number at pre-processor stage only ?
Q2) In C++ NULL is defined as* #define NULL 0* while in C it is defined as
*#define
NULL (void *) 0 . *What difference it makes ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
Both Tech and Apti papers were MCQs . And the questions are not that tough .
Therefore they expect very good marks in written test . Some questions might
ask you some intricate things about C or C++ like questions related to heaps
, dynamic/static memory and other general computer concepts .
Write a code in C/C++ to find the largest BST sub-tree in a binary tree .
Eg:-
10
/ \
5 15
no of nodes
--
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/-/MuNISw2QkYIJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
This question was asked by ST micro for hiring intern in my college . Here's
the solution :
Let the bottles of alcohol named 0 to 5 then -
No.Binary Value
00 0 0
10 0 1
20 1 0
30 1 1
41 0 0
51 0 1
Mice - a b c
Now make the mice drink alcohol
Can anybody please explain how to solve this question with logarithmic
time complexity ?
Write the code/algorithm to find the k-th Smallest Element in the
Union of Two Sorted Arrays .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
Hey Guys, these questions were asked from me during Broadcom India interview
rounds in my college. I hope this would be useful for those interested in
this firm.
They wanted a person with good knowledge of C + Networking + Microprocessor
and project in any of these technologies would be
Convert Binary tree to BST in most efficient way ?
--
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
Algorithm to find the two numbers whose difference is minimum among the set
of numbers.
For example the sequence is 5, 13, 7, 0, 10, 20, 1, 15, 4, 19
The algorithm should return min diff = 20-19 = 1.
Constraint - Time Complexity O(N) Space is not a constraint [upto O(3N)]
--
You
fun(n)
{
if(n=2)
return (1);
else
return ((fun(n-1)*fun(n-2));
}
find the order of complexity .
--
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,
Could u pls explain ??
--
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 options,
You are given a bst where each node has a int value , parent pointer , and
left and right pointers , write a function to find a path with a given sum
value. Path can go from left subtree tree , include root and go to right
tree as well . we need to find these paths also .
5
/ \
1 10
/ \ / \
0
When we can convert Derived* to Base* then why can't we convert Derived** to
Base** ??
--
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
There is a row of houses in which each house contains some amount of money.
Write an algorithm that loots the maximum amount of money from these houses.
The only restriction is that you cannot loot two houses that are directly
next to each other.
--
You received this message because you are
Write a program which prints all the combination of 10 A's and 10 B's .
--
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
Q1) How to declare a multidimensional array using new operator ??
Q2) What's the use of virtual friend function ? Give egs.
Q3) What's the order of construction of objects for a class Derived which -
contains an object of class Data1 , inherits a class Base1 and then
inherits virtual base class
Does anyone has solution to Operating System by Galvin or by William
Stallings ??
--
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
Q1)An array A[1 n] contains all the integers from 0 to n except for one
number which is missing . In this problem, we cannot access an entire
integer in A with a single operation . The elements of A are represented in
binary, and the only operation we can use to access them is “fetch the jth
Find the largest BST in a binary tree ? What's the complexity of your algo
(Amazon Question).
--
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,
Can anyone help me find some questions or post some questions on
Synopsys(EDA tool-based company) for Software Engineer profile ? Or did
anyone had an interview with them ? It is visiting our college in few weeks
for campus recruitment . I will be thankful if anyone could give some
suggestions
I don't think the inner loop is executing only once . Kindly check it for
this test case {1,3,5,8,9,2,6,7,6,8,9} . And try to print i in inner loop
you will find that for same values of i(Outer index) inner loop is called.
Its an O(n2) solution .
--
You received this message because you are
@balaji - In the first tree , 9 has one only child which is not possible
for this question.
@juver++ - Can you give some algo for this problem
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
A special type of tree is given, where all leaf are marked with L and others
are marked with N. every node can have 0 or at most 2 nodes. Trees preorder
traversal is given give a algorithm to build tree from this traversal.
--
You received this message because you are subscribed to the
Does anyone know where is the solution to rectangle problem in this group ??
--
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
DFS and BFS won't work . Eg : check guptaz post and tell me how its gona
work if x = A , y = D and z = C. The only solution is through LCA .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Given three lists: A, B and C of length n each. Write a function which
returns true if any 3 three numbers (1 from each list), sum up to zero. Else
return false, if there is no such combination.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
Convert in O(n) time and O(1) space :
a1,a2,a3,a4,.aN,b1,b2,b3,b4,.,bN to
a1,b2,a2,b2,a3,b3,a4,b4,..aN,bN.
--
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
No its a single array . You have to convert first array into second in
O(n) time and O(1) space .
--
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,
Post your resume on some Job search website or try LinkedIn(Job search
option) . In the search engine (of that website) put trainee or
software trainee . You might find some useful result there . Or google
search internship .
--
You received this message because you are subscribed to the Google
I think first we need to sort the boxes in decreasing order of
height , width and length so that input like this (7,8,9),(5,6,8),
(5,8,7),(4,4,4),(3,2,1),(9,9,10),(9,3,7) becomes
(9,9,10),(9,3,7),(7,8,9),(5,8,7),(5,6,8),(4,4,4),(3,2,1) . Now we can
apply DP here . Let dp[i] = maximum no. of boxes
I think first we need to sort the boxes in decreasing order of volume
so that input like this (7,8,9),(5,6,8),(5,8,7),(4,4,4),(3,2,1),
(9,9,10),(9,3,7) becomes (9,9,10),(7,8,9),(5,8,7),(5,6,8),(9,3,7),
(4,4,4),(3,2,1) . Now we can apply DP here . Let dp[i] = maximum no.
of boxes fitting into each
I think this is a modification of longest increasing subsequence
problem . First , sort by length then find the longest increasing
subsequence by width. Now, in this solution find longest increasing
subsequence by height . This would be the answer to this question.
--
You received this message
Write a code that returns the 5 most common occuring strings in a
list
for example list would be something like
a b c f a d e f b f f
and the function would return
f 4
a 2
b 2
c 1
d 1
I know the Count sort method . Just wanted to know is there any
shorter method as count sort uses lots of space .
We can apply count sort here also and take the range of numbers as
256 . Example take an array c[256] , where c[i] gives the number of
times i_th ASCII value is repeated . Then after you have obtained
c[256] . Check for maximum 5 nos. in this array (which can be done in
O(n) time and space).
--
There is a binary tree(Not a BST) in which you are given three nodes
x,y,z .Write a function which finds whether y lies in the path b/w x
and z.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
I meant any test cases you think I haven't covered in my solution.
Although I have run this solution and checked answer manually .
--
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.
Thanks
--
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
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group
Good solution but what would be the time complexity ??
--
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
Please write the recursive DP formula for this question .
--
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
Given an array of integers, each element represents the max number of
jumps can make forward. What is the minimum number of element
selections to reach the end of the array (starting from the first
element).
Example: arr = 1, 3, 5, 8, 9, 2, 6, 7, 6, 8, 9
Here the min # of selections is : 3
with
Given an array of integers, each element represents the max number of
jumps can make forward. What is the minimum number of element
selections to reach the end of the array (starting from the first
element).
Example: arr = 1, 3, 5, 8, 9, 2, 6, 7, 6, 8, 9
Here the min # of selections is : 3
with
I think your solution will take O(n3) time , as it will require three
loops . 1st for index i , 2nd for first max and 3rd for second max .
Instead we should take :
dp[i] = max(dp[j]) + p[i] , where ji and m[i] - m[j] k . Pls
correct me if something is wrong .
--
You received this message
We are given a checkerboard which has 4 rows and n columns, and has an
integer written in each square. We are also given a set of 2n pebbles,
and we want to place some or all of these on the checkerboard (each
pebble can be placed on exactly one square) so as to maximize the sum
of the integers in
Thanks everyone for suggestions and follow my Dynamic Programming -
Series for more questions on DP .
--
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
Yuckdonald's is considering opening a series of restaurants along
Quaint Valley Highway (QVH).The n possible locations are along a
straight line, and the distances of these locations from the start of
QVH are, in miles and in increasing order,m1;m2; : : : ;mn. The
constraints are as follows:
1)At
80 matches
Mail list logo