@All are these output's correct ??
288230376151711744 20164264869698944
144115188075855872 5130634330054016
72057594037927936 5130634330054016
36028797018963968 1306288411057536
18014398509481984 1306288411057536
9007199254740992332818957147520
4503599627370496
In the link you have specified they are talking about using the C++
STL . I would like to know how is that STL implemented
--
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
What are the parameters it is taking i and j? What are those? We only
have to permute(s)-where s is the string.
--
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
http://www.allisons.org/ll/AlgDS/Tree/Suffix/#demoForm
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Wed, Dec 28, 2011 at 11:27 AM, sumit mahamuni sumit143smail...@gmail.com
wrote:
Slow code that scales better can be faster than fast code
Given a long string and a given word find out how many times you can
write that word using subsets of the string. (i.e., you can create
dog with doom dogged 8 times.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Algo:
---
Take the reverse of the given string and find the continuous matching
substring of even length in the orig and rev str.
We need to take care of certain corner cases such as:
Say orig str = abadba
rev str = abdaba
On finding the continuous substring we will get ab which is not a
how?
--
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, visit this group at
Well. this seems interesting question.
1 You have to break the string to the lowest possible subset. I know O(log
n) algo for this.
2 Number of possibilities of creating a second sentence from this subset.
This is subset formation and I guess will take O(nlogn) atleast for n
possible elements.
@sumit : whats your nlogn approach ???
On Wed, Dec 28, 2011 at 11:27 AM, sumit mahamuni sumit143smail...@gmail.com
wrote:
Here I can think of O( n * log n ). can anyone think of better solution??
On Tue, Dec 27, 2011 at 11:06 PM, atul007 atul.87fri...@gmail.com wrote:
Given a string of
For simplicity of understanding u can take a 2 dimensional array and
jolt down the values ...
For ex -
Orig Str = abcddcabar
109 8 7 6 5 4 3 21
0 r a b a c d d cba
0 0 0 0 0 0
@above..
It seems the above formatting has messed up.. but the point being if
we calculate col by col u will get the values and it shall be easy to
understand...
@sumit
Hey, u don't u share ur NlogN approach and probably we can come up
with something better..
On Dec 28, 3:37 pm, Lucifer
@another approach..
We can also solve the above algo in O(N^2) time and O(1) space..
Just pick an index and check whether a palindrome exits keeping the
index as the center..
Complexity would be =
1 + 2 + 3 + .. + N/2 + N/2 + ... 1 = O(N^2)
On Dec 28, 3:40 pm, Lucifer sourabhd2...@gmail.com
@Lucifier : could you please send you explanation whose formatting in
messed up.
attach a test file , having your explanation.
btw can you check my algo mentioned above using hastable...it is just
convenient way to solve this problem. complexity is same as your algo.
On Wed, Dec 28, 2011 at 4:10
@1..
A recursive app shall do...
@2
Isn't this problem similar to LCS problem where the constraint is the
length of LCS being the size of the 2nd string and we need to keep
track of the count for that particular length.
A slight modification to the LCS technique shall solve it..
On Dec 28, 3:07
@atul..
The explanation is the same as the initial algo that i have
mentioned..
I have just expanded the O(N) space to O(N^2) for better tracing of
what happening inside
the while loop...
The example test case that i have given above just got some formatting
issue and its nothing but some
@lucifer : little more explanation for your this algo:-
*@another approach..
We can also solve the above algo in O(N^2) time and O(1) space..
Just pick an index and check whether a palindrome exits keeping the
index as the center..
Complexity would be =
1 + 2 + 3 + .. + N/2 + N/2 + ... 1 =
@atul : my approach is little modification of merge sort algo.
1) go to middle of string and from middle goto left and right doing
comparisons till you find match.
2) here you found some palindrome string of length n(which is even)
3) now find the even length palindrome substring for left and
Does your algo will take of repeated elements?
In the above example
there are 2 d's and 3 o's and 2 d's and hence it is resulting in 2x2x2
= 8 times dog
On Dec 28, 3:58 pm, Lucifer sourabhd2...@gmail.com wrote:
@1..
A recursive app shall do...
@2
Isn't this problem similar to LCS problem
Don't forget repeats. The string aaa has only one permutation.
A related interesting question is how to write a permutation
iterator. Here is the interface:
typedef struct {
// your code here
} PERMUTATION_ITERATOR;
/* Initialize the given permutation iterator with the string of n
there will be 4 sections.
linux (shell based programming questions) , sql (not basic questions) , c
and aptitude.
--
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
@ravu
I have mentioned how next permutation works.. Also i have given an
example in another post. Please go thru the link..
On Dec 28, 10:47 pm, Gene gene.ress...@gmail.com wrote:
Don't forget repeats. The string aaa has only one permutation.
A related interesting question is how to write a
Thanks for the reply I am asking about the Telephonic round .. wht types of
question are asked ..
In the written round :-
C++ was full of Class , Exceptions , namespaces , Polymorphism , Errors and
Output
Sql was full with Table joins , triggers .
Unix was Easy .
Aptitude was easy
I want to
ooops sry i have no idea about that..
--
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
@sumit
I think even a divide conquer approach would lead to O(N^2)
I think the timing complexity equation would be as follows:
T(N) = T(N/2) + k* (N/2)^2 .. here k is a constant...
T(N) = O(N^2)..
I think your approach is same as the 2nd approach that i have
mentioned above...
Please,
Editing mistake in the last sentence..
Now as explained above there are (N-1) interimIndices for N chars
ranging from 1 to N-1...
On Dec 29, 12:39 am, Lucifer sourabhd2...@gmail.com wrote:
@sumit
I think even a divide conquer approach would lead to O(N^2)
I think the timing complexity
@atul
Can u explain your approach of hashing with an example..
On Dec 29, 12:41 am, Lucifer sourabhd2...@gmail.com wrote:
Editing mistake in the last sentence..
Now as explained above there are (N-1) interimIndices for N chars
ranging from 1 to N-1...
On Dec 29, 12:39 am, Lucifer
This is really an interesting problem. If it is searched from the left to
right the most possible subset is 7 and for the 8th number we have to track
from right to left.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Dude please ask these question on Interviewstreet group..
Your queries will be answered there
Kindly adhere to the protocols of this group..
This may be one off thing but it can lead to start of interview queries.So
please understand :)
On Thu, Dec 29, 2011 at 12:35 AM, Jyoti Malik
#NOTE: Below i have consistently used the word occurrences..
By occurrences i mean the no. of ways Str2 can be formed
by using chars of Str1...
Algo:
--
An O(K*N) approach with O(K*N) space..
Here,
N = size of the first string..
K = size of the 2nd string... (search
@topcoder
The above given algo takes care of repeated elements..
Let me know if u find a test case where its failing..
On Dec 29, 12:47 am, Tamanna Afroze afroze...@gmail.com wrote:
This is really an interesting problem. If it is searched from the left to
right the most possible subset is 7
@rajat..
First of all.. sorry for the late reply :)
Below i have explained the dp approach by taking.. Once u trace it u
will be able to understand the code..
Lets denote the no. of digits by K..
Now when K = 1, then the no. of digits that can formed is 10 i.e 0 to
9...
Say, P(K) denotes the
The no. of binary trees that can be generated having n nodes would be:
(2n C n) / (n+1) i.e the catalan no.
On Dec 28, 12:06 am, bugaboo bharath.sri...@gmail.com wrote:
Given an inorder traversal only for a binary tree (not necessarily a
BST), give a pseudo code to generate all possible binary
Nice Soln Lucifer,
i had problem of tracking kth value when coming across two siblings, each
sibling has many childs
so i think a bottom up approach would be better for finding number of
elements(say* y*) x
finally at root we have y,
if y=k then kth element is x
else kth elemnt is x
Surender
On
@samm
make sure in which project they will put u in.
there are project which does not require much of coding and algo...so i
dont think it will be of your interest.
On Thu, Dec 29, 2011 at 12:11 AM, SAMMM somnath.nit...@gmail.com wrote:
Can anyone tell me the type of questions asked in Amdocs
@atul
The example that u have taken, is it correct ?
I see that in the search string 'abcdtrwdcba' acc to u the even length
palindrome is abcddcba..
On Dec 29, 9:23 am, atul anand atul.87fri...@gmail.com wrote:
@Lucifier :
this is wat i was trying to say :-
string = abcdtrwdcba
find even
@Lucifer
Your solution works :)
On Dec 29, 2:41 am, Lucifer sourabhd2...@gmail.com wrote:
@topcoder
The above given algo takes care of repeated elements..
Let me know if u find a test case where its failing..
On Dec 29, 12:47 am, Tamanna Afroze afroze...@gmail.com wrote:
This is
Given an n x n grid with a person and obstacles, how would you find a
path for the person to a particular destination? The person is
permitted to move left, right, up, and down
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
@Lucifier :
this is wat i was trying to say :-
string = abcdtrwdcba
find even length substring and hash them , moving from left to right.
hash(abcdtrwdcba) // corner case
hash(ab)
hash(abcd)
hash(abcdtr)
.
.
.
hash(dcba).
after hashing is done.
again hash moving from right to left.
As its required to generate all possible binary trees with the given
in-order sequence,
Lets hold all the root nodes of generated binary trees in the form of
singly linked list.. The structure of the same would be..
struct rootNodes
{
struct node *root; // holds the root pointer of a binary
If I am right this looks more like a maze solving strategy, where you can
have a look at this link
http://journals.analysisofalgorithms.com/2011/08/efficient-maze-solving-approach-with.html
On Thu, Dec 29, 2011 at 10:19 AM, top coder topcode...@gmail.com wrote:
Given an n x n grid with a
A standard backtracking shall work...
On Dec 29, 10:02 am, Raghavan its...@gmail.com wrote:
If I am right this looks more like a maze solving strategy, where you can
have a look at this
linkhttp://journals.analysisofalgorithms.com/2011/08/efficient-maze-solvi...
On Thu, Dec 29, 2011 at
@atul I am not sure whether I got ur question correctly.If you only want to
check whether an even palindrome exist or not,then u can check for whether
adjacent characters are same or not.It is very simple.If you want the
longest string then its gets difficult.Same algo can be also used for
@atul If we need to find the longest palindrome whether even or odd we can
use DP.The recursion can look this:
LP(i,j) = max( LP(i+1,j),LP(i,j-1) if(string[i]!=string[j])
max( LP(i+1,j),LP(i,j-1),LP(i+1,j-1)+1 ) else
Note : Do
and i guess i understood it wrongly . for my solution question should be :-
Given a string of length N, find whether there exits an even length
reverse substring of a substring.
so we have have 2 solution to 2 different question on one single post :)
:).
next time onward i have read question
@Lucifier.
i guess we both are understanding this problem differently :-
given question is :-
Given a string of length N, find whether there exits an even length
palindrome substring.
i am understanding it as taking an even length substring and finding if
there exists palindrome of this
for the given string even lenght palindrome found is *abcd* not *abcddcba*
string = *abcd*trw*dcba*
how's it abcddcba??
On Thu, Dec 29, 2011 at 10:08 AM, Lucifer sourabhd2...@gmail.com wrote:
@atul
The example that u have taken, is it correct ?
I see that in the search string 'abcdtrwdcba'
@Lucifier :
Hey the equation you made is not what as mine :).
here it is..
at each point we are doing comparisons from middle the complexity is O(n)
and we are doing the same for left and right half so the complexity is
2T(n/2). So equation becomes
T(n) = 2T(n/2) + O(n)
according to masters
47 matches
Mail list logo