Ohhh... Sorry sorry... silly question... Was thinking complexly :(
On Tue, Nov 22, 2011 at 1:28 PM, Anika Jain anika.jai...@gmail.com wrote:
yes..
On Tue, Nov 22, 2011 at 1:23 PM, Aniket aniket...@gmail.com wrote:
Can a function return a void pointer ?
--
You received this message
This is a Great Question ..
Answering My Opinion as Follows :-
1 Its QuickSort :- Coz we compare on the basis of pivotal element so , we
are reducing half (or More ) of the total comparison by picking the the
pivot as a bench mark. All rest of the sorting do the full
element comparison.
2 Its
Ignore the previous post.. Was meant for some other post :)
On Tue, Nov 22, 2011 at 1:39 PM, saurabh koar koarsaur...@gmail.com wrote:
Ohhh... Sorry sorry... silly question... Was thinking complexly :(
On Tue, Nov 22, 2011 at 1:28 PM, Anika Jain anika.jai...@gmail.comwrote:
yes..
On Tue,
ya
void * malloc(void * ptr)
since void * is generic pointer,it can converted to pointer of any type and
vice versa
On Tue, Nov 22, 2011 at 1:28 PM, Anika Jain anika.jai...@gmail.com wrote:
yes..
On Tue, Nov 22, 2011 at 1:23 PM, Aniket aniket...@gmail.com wrote:
Can a function return a
Hi Atul,
You're correct. I was commenting on the original poster's words I
guess its NlogN for balanced tree as it is traversing N nodes for H
times, which is not correct.
The general result is that the run time will be O(N) for any balance
rule where the ratio R of left to right subtree size
first try to understand the sol then comment. it is for binary tree not for
BST.
On Mon, Nov 21, 2011 at 10:25 PM, Piyush Grover
piyush4u.iit...@gmail.comwrote:
For BST it would be rather simpler. find the first node which lies in
between the two.
On Wed, Nov 16, 2011 at 1:44 PM, anshu
If you maintain the parent, it'll be a simple problem.
Just go to the two nodes and then trace their parents till you reach the
common node.
On Tue, Nov 22, 2011 at 1:59 PM, anshu mishra anshumishra6...@gmail.comwrote:
first try to understand the sol then comment. it is for binary tree not
for
In C language , the NULL is defined as int under stdio.h, has value 0, so
you can do subtraction of NULL pointers,
On Wed, Nov 16, 2011 at 6:57 AM, Dan dant...@aol.com wrote:
Just FYI,
You need to (and should always) be specific. Many languages have
pointers. Many do not. Of those that
Yes
Functions returning void pointers are generally used for generic
programming.
--
Thanks and Regards
*Devansh Gupta*
*B.Tech Third Year*
*MNNIT, Allahabad*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
@anshu
I was just replying to the earlier comments not to ur post.
On Tue, Nov 22, 2011 at 2:23 PM, abhishek kumar abhi5...@gmail.com wrote:
If you maintain the parent, it'll be a simple problem.
Just go to the two nodes and then trace their parents till you reach the
common node.
On Tue,
Hi
This type of function overloading works in c .
Execute following code and it will call function fun as per the
function parameter
code snip-in
-
#includestdio.h
void fun(const char *p)
{
printf(funsfsdafsf1\n);
}
void fun(char *P)
{
printf(fun2\n);
}
void
Input: A unsorted array of size n.
Output: An array of size n.
Relationship:
elements of input array and output array have 1:1 correspondence.
output[i] is equal to the input[j] (ji) which is smaller than input[i] and
jth is nearest to ith ( i.e. first element which is smaller).
If no such
Given a set of points in 2D space, how to find the k closest points
for a given point, in time better than nlgn.
--
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
@Ganesha: You could use a max-heap of size k in time O(n log k), which
is less than O(n log n) if k O(n).
Dave
On Nov 22, 8:56 am, ganesha suresh.iyenga...@gmail.com wrote:
Given a set of points in 2D space, how to find the k closest points
for a given point, in time better than nlgn.
--
@SAM: in your first step, where you are xoring the unique elements, you
must be using some DS such as hashtable or something.
so space complexity will be O(n).
can someone reduces this O(n) space complexity.because it wont be a
good approach if there are many elements in the
On Tue, Nov 22, 2011 at 8:43 PM, Dave dave_and_da...@juno.com wrote:
@Ganesha: You could use a max-heap of size k in time O(n log k), which
is less than O(n log n) if k O(n).
We can always ensure that k = n/2.
If k = n/2 then the problem can be stated as, find m points farthest from
the
Run this one:
#includestdio.h
void fun(const char *p)
{
printf(const\n);
}
void fun(char *P)
{
printf(simple\n);
}
int main(void)
{
char str[] = funcheck;
//const char str1[] =
constcheck;
fun(str);
fun(str);
}
On Tue, Nov 22, 2011 at 7:13 PM, MJ mayurdj...@gmail.com wrote:
Hi
What this means compiler looks for closest possible match ,then other
alternatives.In this func(char*) is executed if that is not there then
func(const char*) is executed.
Comment the func(char*) and check.There is no overloading in c as far i
know.
On Tue, Nov 22, 2011 at 10:11 PM, Jagannath
I can't think of a better than O(n^2) solution for this..
Any one got anything better?
On Tue, Nov 22, 2011 at 8:23 PM, Ankuj Gupta ankuj2...@gmail.com wrote:
Input: A unsorted array of size n.
Output: An array of size n.
Relationship:
elements of input array and output array have 1:1
@Vikas : what is the meaning of Allones function??
On 8 November 2011 15:13, Chunyuan Ge hhy...@gmail.com wrote:
Say you define ur matrix in M
then
if (M(i,j) = 1)
Sq(i,j) = min(Sq(i-1,j),Sq(i-1,j-1),Sq(i, j-1)) + 1
else
Sq(i,j) = 0
On Tue, Nov 8, 2011 at 7:27 AM, vikas
here is an O(n) approach using a stack.
problem can be stated as find the 1st smaller element on the right.
put the first element in stack.
take next element suppose num if this number is less than elements
stored in stack, pop those elements , for these pooped elements num will
be the
use a max heap of size k,
On Tue, Nov 22, 2011 at 11:38 PM, Aamir Khan ak4u2...@gmail.com wrote:
On Tue, Nov 22, 2011 at 8:43 PM, Dave dave_and_da...@juno.com wrote:
@Ganesha: You could use a max-heap of size k in time O(n log k), which
is less than O(n log n) if k O(n).
We can always
On Tue, Nov 22, 2011 at 11:50 PM, tech coder techcoderonw...@gmail.comwrote:
here is an O(n) approach using a stack.
problem can be stated as find the 1st smaller element on the right.
put the first element in stack.
take next element suppose num if this number is less than elements
@Aamir: But assuring that k = n/2 isn't the same thing as saying that
k O(n). Note that if k = n/2, then O(n log k) = O(n log n).
Dave
On Nov 22, 10:38 am, Aamir Khan ak4u2...@gmail.com wrote:
On Tue, Nov 22, 2011 at 8:43 PM, Dave dave_and_da...@juno.com wrote:
@Ganesha: You could use a
What do you mean by if this number is less than elements stored in
stack
There have be N comparisons in the worst case. And that way, you have to do
it for every element.
So it will be governed by O(n^2)
On Wed, Nov 23, 2011 at 12:50 AM, Aamir Khan ak4u2...@gmail.com wrote:
On Tue, Nov
One way could be sorting the array and also storing the original index
along with that. After that we can search linearly in the array.
On Nov 23, 5:40 am, Anup Ghatage ghat...@gmail.com wrote:
What do you mean by if this number is less than elements stored in
stack
There have be N
It means that the Borders of the mavximum rectangle should hav all 1s
irrespective the elements inside the rectangles , it can be either 0
or 1 .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
It means that the Borders of the mavximum rectangle should hav all 1s
irrespective the elements inside the rectangles , it can be either 0
or 1 .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
28 matches
Mail list logo