you can't implement in O(log n). It can be done in O(log n) in case of
Ranked BS Tree.
--
Amitesh
On Sun, Jan 20, 2013 at 6:23 PM, Praveen praveensonare...@gmail.com wrote:
If for all the nodes in BST we also store the size of subtree, then it is
possible to find nth smallest element in
Given a binary search tree and a target value, find all the paths (if there
exists more than one) which sum up to the target value. It can be any path
in the tree. It doesn't have to be from the root.
--
Amitesh
--
Hi,
Just wondering if anybody know the implementation of inplace_merge()
defined in C++/STL (algorithm ?
Source: http://www.cplusplus.com/reference/algorithm/inplace_merge/
Thanks
--
Amitesh
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
of elements, inplace_merge() alters
the existing ranges to perform the merge in-place. --- cppreference.com
On Thu, Oct 11, 2012 at 4:02 PM, Amitesh Singh singh.amit...@gmail.comwrote:
Hi,
Just wondering if anybody know the implementation of inplace_merge()
defined in C++/STL (algorithm
Does the pattern comes in this way? HT,TH,TT or HT(X)TH(X)TT ??
Let me know.
--
Amitesh
On Sat, Aug 11, 2012 at 11:24 PM, Piyush pkjee2...@gmail.com wrote:
How can I find the expected number of tosses , required to obtain a
{HT,TH,TT} , by using random variables??
On Friday, December
time to do that for you. Please help yourself.
Thanks
--
Amitesh Singh
On Sun, Aug 12, 2012 at 10:32 PM, Amitesh Singh singh.amit...@gmail.comwrote:
Does the pattern comes in this way? HT,TH,TT or HT(X)TH(X)TT ??
Let me know.
--
Amitesh
On Sat, Aug 11, 2012 at 11:24 PM, Piyush
void printPath(node *p,node *child)
{
if( p child)
std::cout Path: p-data =child-data
std::endl;
}
use this before you assign 'current' to its children.
e.g.
printPath(p,p-left)
or
printPath(p,p-right);
--
Amitesh
On Mon, Jun 25, 2012 at 11:34 PM, Nishant
, 2012 at 11:01 AM, Amitesh Singh singh.amit...@gmail.comwrote:
void printPath(node *p,node *child)
{
if( p child)
std::cout Path: p-data =child-data
std::endl;
}
use this before you assign 'current' to its children.
e.g.
printPath(p,p-left)
or
printPath(p
It can be done using Queues in O(n).
--
Amitesh
On Wed, Jun 27, 2012 at 3:07 PM, hary rathor harry.rat...@gmail.com wrote:
apply BFS
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
It can done using pure virtual destructor.
struct A
{
//your implementation ..
..
..
virtual ~A() = 0;
};
A::~A()
{
}
--
Amitesh
On Fri, Jun 22, 2012 at 1:44 PM, himanshu kansal
himanshukansal...@gmail.com wrote:
How will u implement an abstract class in c++ w/o using
a pure virtual function does not have definition. Since pure virtual
destructor has a definition so its only for not allowing the object
instantiation, although it does not have any other abstract functions.
--
Amitesh
On Fri, Jun 22, 2012 at 1:51 PM, Amitesh Singh singh.amit
Krishna,
how can you store a address pointing to k bits value into k/2 bits? XOR
is the way to do this.
--
Amitesh
On Thu, Jun 21, 2012 at 1:20 AM, Krishna Kishore
kknarenkris...@gmail.comwrote:
*np *is nothing but *next_pointer. np[x] *does mean *x-np *which is the
next pointer to
Thanks Hassan. But I was more interested in knowing the mathematic proof of
Partial Quick Sort.
--
Amitesh
On Sun, Jun 17, 2012 at 7:54 PM, Hassan Monfared hmonfa...@gmail.comwrote:
O(N*logM)
On Sat, Jun 16, 2012 at 5:15 PM, Amitesh Singh singh.amit...@gmail.comwrote:
Hi Guys
check out this:
RANDOMIZED-SELECT in O(n):
http://amiteshsingh.wordpress.com/2012/06/08/iterative-randomized-select/
--
Amitesh
On Sun, Jun 17, 2012 at 1:24 PM, Ashish Goel ashg...@gmail.com wrote:
is the modification of the given array allowed?
if yes use quick select, otherwise build
This problem is similar to Coupan collector problem.
http://en.wikipedia.org/wiki/Coupon_collector%27s_problem
In your case the answer is
[image: For N-Dice ; \newline \sum_{i=1}^{N} N/i \newline for\; N =~2 ;
\newline \sum_{i=1}^{2} 2/i = 2/1 + 2/2 = 3 \newline]
Hope it helps!
--
Amitesh
Hi Guys,
*Problem: *Rearrange a given array with n elements, so that m places
contain the m smallest elements in ascending order.
*Solution 2:* using QuickSort method approach.
[image: n = r -p + 1]
[image: \bold{PARTIAL-QUICKSORT(A,p,r,m)}: \newline if\; pr \newline q
\leftarrow
just curious to know if this question is asked in any interviews? Google
interview?
--
Amitesh
On Sun, Jun 17, 2012 at 12:09 AM, Amitesh Singh singh.amit...@gmail.comwrote:
This problem is similar to Coupan collector problem.
http://en.wikipedia.org/wiki/Coupon_collector%27s_problem
signals and logjmp/setjmp()
--
Amitesh
On Wed, Jun 13, 2012 at 10:40 AM, saurabh singh saurab...@gmail.com wrote:
tHE first thing that comes in my mind Signals
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com
On Tue, Jun 12, 2012 at 10:26 PM,
18 matches
Mail list logo