The simplest algorithm is probably to check each point against all
others while maintaining a list of the top 3. Since 3 is a small
number, you can just maintain the top 3 in sorted order by insertion.
For a bigger K top-K you'd use a max heap.
This can also be done in O(n log n) time by building
Hi,
*int sum(int num1,int num2)
{
for(int i=0;ihttp://groups.google.com/group/algogeeks?hl=en.
@UTKARSH SRIVASTAV
Give the implemetation logic instead of the name of the DS .
--
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
a
wrong post on wrong group.
On Thu, Dec 22, 2011 at 10:41 PM, aditi garg wrote:
> Has anyone appeared fr Microsoft sales and marketing interview...if so
> plz throw some light on it...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> T
@Arun : yup ...rite...
so i guess this will work..once pointer has been updated for parent node.
there is no need of other point from children[i+1] to n. so adding one
more loop at the end.
for(i=0;ichildren[i],NULL);
if(pre)
{
pre->childr
Has anyone appeared fr Microsoft sales and marketing interview...if so
plz throw some light on it...
--
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 gro
@Terence : got it :) :) ...inc/dec wont work
On Thu, Dec 22, 2011 at 10:57 AM, Terence wrote:
> Then what's your output for test case "()(()"?
>
>
> On 2011-12-22 12:45, atul anand wrote:
>
> i guess there is no need of stack , we can take a variable say top;
>
> increment top when open bracket
got it :)
On Thu, Dec 22, 2011 at 10:57 AM, Terence wrote:
> Then what's your output for test case "()(()"?
>
>
> On 2011-12-22 12:45, atul anand wrote:
>
> i guess there is no need of stack , we can take a variable say top;
>
> increment top when open bracket occur "(" and decrement when close
@venky : u call this code???
On Thu, Dec 22, 2011 at 7:44 PM, venky wrote:
> #include#include#define maxsize 100
> struct stack{ int A[maxsize]; int top;}; struct stack s;void
> push(int
> index){ s.top++;if(s.top==maxsize) {
> printf("cannot be pushed"); }
> else{
#include#include#define maxsize 100
struct stack{ int A[maxsize]; int top;}; struct stack s;void push(int
index){ s.top++;if(s.top==maxsize) { printf("cannot
be pushed"); }
else{ s.A[s.top]=index; }}
int pop(){ int a; a=s.top;
Already discussed n times...nth discussion not required
http://www.mail-archive.com/algogeeks@googlegroups.com/msg27861.html Check
this link.
On Thu, Dec 22, 2011 at 10:59 AM, Deepika Srinivisan <
deepikasrini1...@gmail.com> wrote:
> @:)) hello frnds
>Can u pls help me out in writ
@atul: can you explain what this is doing?
for(i=0;ichildren[i],NULL);
if(pre)
{
pre->children[i]=root;
}
}
when u do tree reversal I see that child points to parent( basically
direction reversed). Now if
1
Then what's your output for test case "()(()"?
On 2011-12-22 12:45, atul anand wrote:
i guess there is no need of stack , we can take a variable say top;
increment top when open bracket occur "(" and decrement when close
bracket ")" occurs.
keep track of first close bracket mismatch i.e when
@:)) hello frnds
Can u pls help me out in writing a pgm how to add two numbers
in C language without using both logical and arithmetic operators
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algo
The first problem I mentioned is a similar problem. but the second one
seems to be little difficult. where additional path we could go is up.
-
Azhar.
On Thu, Dec 15, 2011 at 10:17 PM, Dheeraj Jain wrote:
> http://www.geeksforgeeks.org/archives/14943 is a very similar problem.
>
>
> On Thu, Dec
And I think the comparing between first unmatched open/close bracket
index is not needed.
If we found an unmatched close bracket (ie. the stack is empty when
encounter a close bracket),
we could return current index immediately, since all open brackets
before that position are matched and popp
16 matches
Mail list logo