Is there a specific way to handle equations to convert it into such a form that it gives right value for any...
$begingroup$
I was trying to find relation between total number of nodes in a complete binary tree and the leaf nodes. Note that a complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.While working it out I got the equation $l=n/2$, where $l$ is the number of leaf nodes and $n$ is the total number of nodes in complete binary tree, if $n$ is even. When $n$ is odd, $l=(n-1)/2$. Now is there a specific way to make these equations into a single equation using floor and ceiling so that it can handle both the cases when n is even or odd. The only way I can think of by plugging the values and observing that it is actually the $lfloor n/2rfloor$.
trees
$endgroup$
add a comment |
$begingroup$
I was trying to find relation between total number of nodes in a complete binary tree and the leaf nodes. Note that a complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.While working it out I got the equation $l=n/2$, where $l$ is the number of leaf nodes and $n$ is the total number of nodes in complete binary tree, if $n$ is even. When $n$ is odd, $l=(n-1)/2$. Now is there a specific way to make these equations into a single equation using floor and ceiling so that it can handle both the cases when n is even or odd. The only way I can think of by plugging the values and observing that it is actually the $lfloor n/2rfloor$.
trees
$endgroup$
$begingroup$
Seems the floor of $n/2$ already does both even and odd. Are you looking for *a proof? * another formula without floor?
$endgroup$
– coffeemath
Jan 12 at 12:27
$begingroup$
Yes, I am looking for a general approach to find that it narrows down to floor of (n/2)
$endgroup$
– Amisha Bansal
Jan 12 at 12:56
$begingroup$
Did you find arguments that show if $n$ even then $l=n/2,$ and if $n$ odd then $l=(n-1)/2$ ? Also since tree is binary, every level, if "completely filled", has 2 descendants if it's not a leaf. A leaf has no descendants. One more thing, what does having nodes "as far left as possible" mean, and what has it to do with counting the nodes (how the tree is drawn doesn't affect how many nodes it has) ?
$endgroup$
– coffeemath
Jan 12 at 13:16
1
$begingroup$
@coffeemath "as far left as possible" signifies that the last level may not be completely filled and hence there can be one node at last level which has 1 child . So basically something like this link is also a complete binary tree.
$endgroup$
– Amisha Bansal
Jan 12 at 14:17
add a comment |
$begingroup$
I was trying to find relation between total number of nodes in a complete binary tree and the leaf nodes. Note that a complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.While working it out I got the equation $l=n/2$, where $l$ is the number of leaf nodes and $n$ is the total number of nodes in complete binary tree, if $n$ is even. When $n$ is odd, $l=(n-1)/2$. Now is there a specific way to make these equations into a single equation using floor and ceiling so that it can handle both the cases when n is even or odd. The only way I can think of by plugging the values and observing that it is actually the $lfloor n/2rfloor$.
trees
$endgroup$
I was trying to find relation between total number of nodes in a complete binary tree and the leaf nodes. Note that a complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.While working it out I got the equation $l=n/2$, where $l$ is the number of leaf nodes and $n$ is the total number of nodes in complete binary tree, if $n$ is even. When $n$ is odd, $l=(n-1)/2$. Now is there a specific way to make these equations into a single equation using floor and ceiling so that it can handle both the cases when n is even or odd. The only way I can think of by plugging the values and observing that it is actually the $lfloor n/2rfloor$.
trees
trees
edited Jan 12 at 12:03
Parcly Taxel
44.2k1375105
44.2k1375105
asked Jan 12 at 12:02
Amisha BansalAmisha Bansal
64
64
$begingroup$
Seems the floor of $n/2$ already does both even and odd. Are you looking for *a proof? * another formula without floor?
$endgroup$
– coffeemath
Jan 12 at 12:27
$begingroup$
Yes, I am looking for a general approach to find that it narrows down to floor of (n/2)
$endgroup$
– Amisha Bansal
Jan 12 at 12:56
$begingroup$
Did you find arguments that show if $n$ even then $l=n/2,$ and if $n$ odd then $l=(n-1)/2$ ? Also since tree is binary, every level, if "completely filled", has 2 descendants if it's not a leaf. A leaf has no descendants. One more thing, what does having nodes "as far left as possible" mean, and what has it to do with counting the nodes (how the tree is drawn doesn't affect how many nodes it has) ?
$endgroup$
– coffeemath
Jan 12 at 13:16
1
$begingroup$
@coffeemath "as far left as possible" signifies that the last level may not be completely filled and hence there can be one node at last level which has 1 child . So basically something like this link is also a complete binary tree.
$endgroup$
– Amisha Bansal
Jan 12 at 14:17
add a comment |
$begingroup$
Seems the floor of $n/2$ already does both even and odd. Are you looking for *a proof? * another formula without floor?
$endgroup$
– coffeemath
Jan 12 at 12:27
$begingroup$
Yes, I am looking for a general approach to find that it narrows down to floor of (n/2)
$endgroup$
– Amisha Bansal
Jan 12 at 12:56
$begingroup$
Did you find arguments that show if $n$ even then $l=n/2,$ and if $n$ odd then $l=(n-1)/2$ ? Also since tree is binary, every level, if "completely filled", has 2 descendants if it's not a leaf. A leaf has no descendants. One more thing, what does having nodes "as far left as possible" mean, and what has it to do with counting the nodes (how the tree is drawn doesn't affect how many nodes it has) ?
$endgroup$
– coffeemath
Jan 12 at 13:16
1
$begingroup$
@coffeemath "as far left as possible" signifies that the last level may not be completely filled and hence there can be one node at last level which has 1 child . So basically something like this link is also a complete binary tree.
$endgroup$
– Amisha Bansal
Jan 12 at 14:17
$begingroup$
Seems the floor of $n/2$ already does both even and odd. Are you looking for *a proof? * another formula without floor?
$endgroup$
– coffeemath
Jan 12 at 12:27
$begingroup$
Seems the floor of $n/2$ already does both even and odd. Are you looking for *a proof? * another formula without floor?
$endgroup$
– coffeemath
Jan 12 at 12:27
$begingroup$
Yes, I am looking for a general approach to find that it narrows down to floor of (n/2)
$endgroup$
– Amisha Bansal
Jan 12 at 12:56
$begingroup$
Yes, I am looking for a general approach to find that it narrows down to floor of (n/2)
$endgroup$
– Amisha Bansal
Jan 12 at 12:56
$begingroup$
Did you find arguments that show if $n$ even then $l=n/2,$ and if $n$ odd then $l=(n-1)/2$ ? Also since tree is binary, every level, if "completely filled", has 2 descendants if it's not a leaf. A leaf has no descendants. One more thing, what does having nodes "as far left as possible" mean, and what has it to do with counting the nodes (how the tree is drawn doesn't affect how many nodes it has) ?
$endgroup$
– coffeemath
Jan 12 at 13:16
$begingroup$
Did you find arguments that show if $n$ even then $l=n/2,$ and if $n$ odd then $l=(n-1)/2$ ? Also since tree is binary, every level, if "completely filled", has 2 descendants if it's not a leaf. A leaf has no descendants. One more thing, what does having nodes "as far left as possible" mean, and what has it to do with counting the nodes (how the tree is drawn doesn't affect how many nodes it has) ?
$endgroup$
– coffeemath
Jan 12 at 13:16
1
1
$begingroup$
@coffeemath "as far left as possible" signifies that the last level may not be completely filled and hence there can be one node at last level which has 1 child . So basically something like this link is also a complete binary tree.
$endgroup$
– Amisha Bansal
Jan 12 at 14:17
$begingroup$
@coffeemath "as far left as possible" signifies that the last level may not be completely filled and hence there can be one node at last level which has 1 child . So basically something like this link is also a complete binary tree.
$endgroup$
– Amisha Bansal
Jan 12 at 14:17
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3070837%2fis-there-a-specific-way-to-handle-equations-to-convert-it-into-such-a-form-that%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3070837%2fis-there-a-specific-way-to-handle-equations-to-convert-it-into-such-a-form-that%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Seems the floor of $n/2$ already does both even and odd. Are you looking for *a proof? * another formula without floor?
$endgroup$
– coffeemath
Jan 12 at 12:27
$begingroup$
Yes, I am looking for a general approach to find that it narrows down to floor of (n/2)
$endgroup$
– Amisha Bansal
Jan 12 at 12:56
$begingroup$
Did you find arguments that show if $n$ even then $l=n/2,$ and if $n$ odd then $l=(n-1)/2$ ? Also since tree is binary, every level, if "completely filled", has 2 descendants if it's not a leaf. A leaf has no descendants. One more thing, what does having nodes "as far left as possible" mean, and what has it to do with counting the nodes (how the tree is drawn doesn't affect how many nodes it has) ?
$endgroup$
– coffeemath
Jan 12 at 13:16
1
$begingroup$
@coffeemath "as far left as possible" signifies that the last level may not be completely filled and hence there can be one node at last level which has 1 child . So basically something like this link is also a complete binary tree.
$endgroup$
– Amisha Bansal
Jan 12 at 14:17