take two integer arrays A and B of size 26 ,A is for storing count and
B is for index .Initialize both the array with 0's. Then iterate
through the string once and keep incrementing the respective character
count in A and store the character index in B. Now in array B find
the minimum index whose
4th element of inorder traversal
On Fri, Oct 8, 2010 at 11:49 PM, Anand anandut2...@gmail.com wrote:
Binary search Tree was given. Find 4ths smallest element.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
AFAIK there is an O(n^3) solution to this problem. anybody with a O(n^2)
or O(n) solution??
Mukesh Gupta
Delhi College of Engineering
On Thu, Oct 7, 2010 at 3:32 PM, tech rascal techrascal...@gmail.com wrote:
can u plz xplain??
On Thu, Oct 7, 2010 at 2:32 PM, Chi c...@linuxdna.com
.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
Mukesh Gupta
Delhi College of Engineering
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge
PM, Mukesh Gupta
mukeshgupta.2...@gmail.comwrote:
Keep inserting elements in a binary search tree and break once you get
the find the element in the tree.
Complexity=O(n log n)
On 10/5/10, sourav souravs...@gmail.com wrote:
You are given an array of positive numbers in which one
@Ankit: Insertion in hashmap in O(n) in worst case. As long as range of the
numbers is not known we cannot predict whether the algo will run in linear
time.
Any other idea for O(n)??
Mukesh Gupta
Delhi College of Engineering
On Wed, Oct 6, 2010 at 4:32 PM, sourav souravs...@gmail.com wrote
set bit. We can extract the rightmost set bit of any
number n by taking ( n ~(n-1))
Here 2nd bit is the rightmost set bit.
Now when we take xor of all values where 2nd bit is set(this could be done
as (a[i] 0010) , we get 6
Taking xor of all values where 2nd bit is not set yields 4.
Mukesh
For base conversion :
int convert(int n,int from,int to)
{
int ret=0,i=0;
while(n0)
{
ret=ret+(n%to)*pow(from,i++);
n/=to;
}
return ret;
}
Mukesh Gupta
Delhi Technological University
On Mon, Oct 4, 2010 at 11:20 PM, Dave dave_and_da...@juno.com wrote:
@Coolfrog
@coolfrog:
problem statement says total number of elements is n .so overall complexity
wud be O(n*logk) only. even i had the same doubt initially.
Mukesh Gupta
Delhi College of Engineering
On Tue, Oct 5, 2010 at 12:46 AM, coolfrog$
dixit.coolfrog.div...@gmail.comwrote:
@Dave
yes it help
,bottom.y)endlTotal number of 1's : max;
}
Mukesh Gupta
Delhi College of Engineering
On Mon, Oct 4, 2010 at 11:23 PM, Chi c...@linuxdna.com wrote:
Maybe you meant this: Multidimensional Range Search in Dynamically
Balanced Trees.
http://www.vision-tools.com/h-tropf
10 matches
Mail list logo