On Thu, Oct 6, 2011 at 3:30 PM, 9ight coder 9ightco...@gmail.com wrote:
hey ankit can u show me 1st question solution
On Oct 5, 9:06 pm, Ankur Garg ankurga...@gmail.com wrote:
Implement recursive merge sort for first question(Implement recursive
merge sort for first question )
For
id we see the pattern then we can easily find that the kth smallest element
lie on the upper half of the k*k submatrix(on the upperleft corner )
we can do search on (k*k)/2 elements to find that
On Mon, Oct 10, 2011 at 10:36 AM, Dave dave_and_da...@juno.com wrote:
@Shubham: So if the matrix is
For every number that has 3 in its units place has one multiple which
has all one's i.e. 111 is
such multiple and 13 has a multiple 11. Write a program to find
such multiple for any
number that has 3 at its units place.
--
You received this message because you are subscribed to the Google
If you want ask for any interview or company related queries , kindly
join new group.
http://groups.google.com/group/interview-street
..Only ALGORITHM RELATED interview questions from any company will
be posted ...Kindly notify your friends too
For more details visit this thread...
Hi,
I dont remember the question text exactly but the following should
convey it well
The question:
A number is said to be an additive number if it has the following format:
3268126844 : 32 6812 6844 : 32 + 6812 = 6844
123581321 : 1 2 3 5 8 13 21 : 1+2 = 3 , 2+3 = 5 , 3+5=8, 5+8 = 13, 8+13
string all1Multiple(int x)
{
string s;
setint mySet;
mySet.push(0);
int psize, r=1;
do
{
psize = mySet.size();
s += '1';
r = r % x;
mySet.push(r);
r = r * 10 + 1;
} while(mySet.size() psize);
if (r != 1) return not Possible;
return s;
}
--
You received this message because you are subscribed
macros i thnik cant swap pointers..i have doubt for same it is test ur c
skil question
On Sun, Oct 9, 2011 at 10:08 PM, sunny agrawal sunny816.i...@gmail.comwrote:
because you have not made any call to swap values of x and y
I Don't know what you are trying to do here
if you want to swap
Can anyone tell me how to go about with the memorization technique to
retrieve values from already stored values,in case of eveluating
sequences(fibonacci series,etc).?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Macros can Swap Pointers. and That is what the above code is doing.
On Mon, Oct 10, 2011 at 5:52 PM, rahul sharma rahul23111...@gmail.comwrote:
macros i thnik cant swap pointers..i have doubt for same it is test ur c
skil question
On Sun, Oct 9, 2011 at 10:08 PM, sunny agrawal
@Shiva: How can min heap be uesd, can you eloborate a bit.
As far as i see, the best possible is O(nlogn) i.e by sorting and scanning
over the complete array once.
On Mon, Oct 10, 2011 at 9:49 AM, shiva@Algo shiv.jays...@gmail.com wrote:
I think Min heap will do that..
On Mon, Oct 10,
just find minimum and secon minimum by taking two variables in O(n)
On 10 October 2011 17:57, sandeep nagamalli nsandee...@gmail.com wrote:
@Shiva: How can min heap be uesd, can you eloborate a bit.
As far as i see, the best possible is O(nlogn) i.e by sorting and scanning
over the complete
algo to find subsets of an array whose sum is equal to a given number..?
--
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
Without sorting the elements we have around n^2 elements to look from, to
find the smalled element.
But, after sort, we will have only n-1 elements to look from. So, O(nlogn)
is what I see, the best case.
Is there really a O(n) solution, as finding the diff between elements should
be done
@ ankur:
if space is not the consideration
first sort them using count sort and then look for the pair with the min.
difference ..
i think it should work .
Snehi
On Mon, Oct 10, 2011 at 7:21 PM, anubhav gupta anubhav.7...@gmail.comwrote:
@deoki try for 1001,999,998,1
On Mon, Oct 10,
is it a contiguous set, any sparse subset or what?
if it's a subset of a set then it can be sparse, but when you say
array you make it quite tricky to figure out.
with all due respect sir,
please mind that when you make a question you're taking peoples time
to answer it
therefore if the answer
Just went throught what a count sort is at
http://en.wikipedia.org/wiki/Counting_sort
If all the elements are distinct which is possible, will this count sort
have any use?
Also, the sorting takes O(nlogn) time right?
Did I miss anything?
--
You received this message because you are
The swap is happenning between the p q pointers,
https://ideone.com/4MdX4
p points to y, q points to x after swap.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
not necessary contiguous..
eg:
we are given with an array-1,4,2,26,8,3 and we need to find the subsets of
this having sum of its members as 11.
ans should be 1,2,8 and 8,3
i hope i am clear this time..
On Mon, Oct 10, 2011 at 9:38 PM, Hatta tmd...@gmail.com wrote:
is it a contiguous set, any
@Sravan ..Counting Sort takes O(n) time but it needs range of nos to be
known
@Snehi jain..there is no range given so am not sure if count sort will work
,Can you please elaborate a bit on ur method
Ankur
On Mon, Oct 10, 2011 at 10:09 PM, sravanreddy001
sravanreddy...@gmail.comwrote:
Just went
Memoization ?
On Mon, Oct 10, 2011 at 6:34 PM, arvind kumar arvindk...@gmail.com wrote:
Can anyone tell me how to go about with the memorization technique to
retrieve values from already stored values,in case of eveluating
sequences(fibonacci series,etc).?
--
You received this message
remove duplicate words from a string with min. complexityy.
--
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
the simplest code could be for this question is
void printAllSubsetSum(int ar[], int n, int x)
{
for (i = 0; i (1n); i++)
{
int sum = 0;
for (j = 0; j n; j++)
{
if ( (1 j) i) sum += ar[j];
}
if (sum == x)
{
ankur : i wont say its the best way, but it can be used
in one traversal the range can be determined and then count sort
can be applied.
On Mon, Oct 10, 2011 at 10:56 PM, Ankur Garg ankurga...@gmail.com wrote:
@Sravan ..Counting Sort takes O(n) time but it needs range of nos to be
Counting Sort is really a Bad option for this Problem as range is not given
yes range can be find in single traversal but think if largest element is
10^9 and size of the array is just about 10^3
Counting Sort = O(10^9)
Simple Sorting = O(10^4)
Counting sort will perform bad in this case both in
I think this can be done through tries
Any better solution ?
On Mon, Oct 10, 2011 at 10:59 PM, sachin goyal monugoya...@gmail.comwrote:
remove duplicate words from a string with min. complexityy.
--
You received this message because you are subscribed to the Google Groups
Algorithm
Trie will take too much space..
Balanced Binary tree can be Better ...??
On Tue, Oct 11, 2011 at 12:16 AM, Ankur Garg ankurga...@gmail.com wrote:
I think this can be done through tries
Any better solution ?
On Mon, Oct 10, 2011 at 10:59 PM, sachin goyal monugoya...@gmail.comwrote:
remove
A radix sort would provide an O(n) solution for any fixed-size integer
data type.
Dave
On Oct 10, 10:19 am, sravanreddy001 sravanreddy...@gmail.com wrote:
Without sorting the elements we have around n^2 elements to look from, to
find the smalled element.
But, after sort, we will have only
one possible ruby solution/pic attached
--
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.
one possible solution in ruby (sry if this is double-posted -- i did not
see it come up the first time)
[image: digsum_output.png]
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
a)
1. could split the string using a regexp (into an array) in which you
define a word -- is hi. the same as hi, and hi ?
2. then perform a unique operation on the array (some languages have
this built in) to remove duplicates
3. recombine array elements into string by joining with a space,
Given two strings describing the version of a particular software need to
find the later version.
For eg.
1st string = 1.2.4.5
2nd string=1.2.3.5
1st string is the later one.
Can be done using traversing the string and comparing each character one
after the another. Looking for a better
@Sunny..How do u intend to store them in a Tree ? Can you explain ?
In a trie u first insert the first word ..take the second word..If its not
present in the trie u insert it else remove it from original string
.Alternatively u store the elements in a trie in the initial string and
terminate it
divide the string in middle and first compare the left sub-string(as they
are MSB)...if they match then compare the right sub-string (iteratively)
if the left substring doesn't match then compare iteratively by dividing
again.
i think this would give complexity in lgn.
Hope this helps!!
On 11
@Ankur
in Trie at each Node there will be 26 Pointers Stored, and Most of them
would be NULL, thats why i think it will waste space,
in Balanced Binary Tree i was thinking of storing the Complete Words at a
Node.
But now i think this is Better - Ternary Search
@Karen: It is more complicated than scanning character by character.
E.g., 1.10.3 is older than 1.9.7. I think you need to parse the
numbers between the dots and compare them one by one. Thus, in the
above example, 1 compares equal to 1, so you keep scanning. Then 10
compares greater than 9 so the
yea DP will be O(given no * n) if all array entries are positive and the
given no is non negative.
On Mon, Oct 10, 2011 at 11:09 PM, anshu mishra anshumishra6...@gmail.comwrote:
the simplest code could be for this question is
void printAllSubsetSum(int ar[], int n, int x)
{
for (i = 0;
Can in place compaction be done without left shifts?
--
Nice Day
Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)
--
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
37 matches
Mail list logo