Find $n$ in a log equation
$begingroup$
I am having trouble solving this problem.
Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size $n$, insertion sort runs in $8n^2$ steps, while merge sort runs in $64 nlog n$ steps. For which values of $n$ does insertion sort beat merge sort?
*$log$ is log base $10$
$rightarrow 8n^2 = 64nlog n$ Divide both sides by $n$
$rightarrow 8n = 64log n$ Divide both sides by $64$
$rightarrow frac{1}{8} = log n$
$rightarrow log_{10}n = frac{1}{8}$
$rightarrow n = 10^{frac{1}{8}}$
When I plug $10^{frac{1}{8}}$ in as $n$, I get $14.215 = 10.649$ so this doesn't seem to add up. Can someone help me understand what I am doing wrong?
logarithms
$endgroup$
add a comment |
$begingroup$
I am having trouble solving this problem.
Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size $n$, insertion sort runs in $8n^2$ steps, while merge sort runs in $64 nlog n$ steps. For which values of $n$ does insertion sort beat merge sort?
*$log$ is log base $10$
$rightarrow 8n^2 = 64nlog n$ Divide both sides by $n$
$rightarrow 8n = 64log n$ Divide both sides by $64$
$rightarrow frac{1}{8} = log n$
$rightarrow log_{10}n = frac{1}{8}$
$rightarrow n = 10^{frac{1}{8}}$
When I plug $10^{frac{1}{8}}$ in as $n$, I get $14.215 = 10.649$ so this doesn't seem to add up. Can someone help me understand what I am doing wrong?
logarithms
$endgroup$
2
$begingroup$
You divided by 64 not by 64n.
$endgroup$
– hamam_Abdallah
Dec 17 '18 at 20:01
$begingroup$
I can't divide by 64n because I canceled n in 64n out in the first step
$endgroup$
– Evan Kim
Dec 17 '18 at 20:05
2
$begingroup$
@EvanKim $frac n8=log n$
$endgroup$
– Shubham Johri
Dec 17 '18 at 20:11
$begingroup$
Oh I see it now
$endgroup$
– Evan Kim
Dec 17 '18 at 20:13
add a comment |
$begingroup$
I am having trouble solving this problem.
Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size $n$, insertion sort runs in $8n^2$ steps, while merge sort runs in $64 nlog n$ steps. For which values of $n$ does insertion sort beat merge sort?
*$log$ is log base $10$
$rightarrow 8n^2 = 64nlog n$ Divide both sides by $n$
$rightarrow 8n = 64log n$ Divide both sides by $64$
$rightarrow frac{1}{8} = log n$
$rightarrow log_{10}n = frac{1}{8}$
$rightarrow n = 10^{frac{1}{8}}$
When I plug $10^{frac{1}{8}}$ in as $n$, I get $14.215 = 10.649$ so this doesn't seem to add up. Can someone help me understand what I am doing wrong?
logarithms
$endgroup$
I am having trouble solving this problem.
Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size $n$, insertion sort runs in $8n^2$ steps, while merge sort runs in $64 nlog n$ steps. For which values of $n$ does insertion sort beat merge sort?
*$log$ is log base $10$
$rightarrow 8n^2 = 64nlog n$ Divide both sides by $n$
$rightarrow 8n = 64log n$ Divide both sides by $64$
$rightarrow frac{1}{8} = log n$
$rightarrow log_{10}n = frac{1}{8}$
$rightarrow n = 10^{frac{1}{8}}$
When I plug $10^{frac{1}{8}}$ in as $n$, I get $14.215 = 10.649$ so this doesn't seem to add up. Can someone help me understand what I am doing wrong?
logarithms
logarithms
edited Dec 17 '18 at 21:15
Yadati Kiran
1,7911619
1,7911619
asked Dec 17 '18 at 19:58
Evan KimEvan Kim
3568
3568
2
$begingroup$
You divided by 64 not by 64n.
$endgroup$
– hamam_Abdallah
Dec 17 '18 at 20:01
$begingroup$
I can't divide by 64n because I canceled n in 64n out in the first step
$endgroup$
– Evan Kim
Dec 17 '18 at 20:05
2
$begingroup$
@EvanKim $frac n8=log n$
$endgroup$
– Shubham Johri
Dec 17 '18 at 20:11
$begingroup$
Oh I see it now
$endgroup$
– Evan Kim
Dec 17 '18 at 20:13
add a comment |
2
$begingroup$
You divided by 64 not by 64n.
$endgroup$
– hamam_Abdallah
Dec 17 '18 at 20:01
$begingroup$
I can't divide by 64n because I canceled n in 64n out in the first step
$endgroup$
– Evan Kim
Dec 17 '18 at 20:05
2
$begingroup$
@EvanKim $frac n8=log n$
$endgroup$
– Shubham Johri
Dec 17 '18 at 20:11
$begingroup$
Oh I see it now
$endgroup$
– Evan Kim
Dec 17 '18 at 20:13
2
2
$begingroup$
You divided by 64 not by 64n.
$endgroup$
– hamam_Abdallah
Dec 17 '18 at 20:01
$begingroup$
You divided by 64 not by 64n.
$endgroup$
– hamam_Abdallah
Dec 17 '18 at 20:01
$begingroup$
I can't divide by 64n because I canceled n in 64n out in the first step
$endgroup$
– Evan Kim
Dec 17 '18 at 20:05
$begingroup$
I can't divide by 64n because I canceled n in 64n out in the first step
$endgroup$
– Evan Kim
Dec 17 '18 at 20:05
2
2
$begingroup$
@EvanKim $frac n8=log n$
$endgroup$
– Shubham Johri
Dec 17 '18 at 20:11
$begingroup$
@EvanKim $frac n8=log n$
$endgroup$
– Shubham Johri
Dec 17 '18 at 20:11
$begingroup$
Oh I see it now
$endgroup$
– Evan Kim
Dec 17 '18 at 20:13
$begingroup$
Oh I see it now
$endgroup$
– Evan Kim
Dec 17 '18 at 20:13
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You have a wrong simplification: the inequality $8n^2<64nlog n$ becomes
$$
n<8log n
$$
You can check that the function $f(x)=8log x-x$ has a maximum at $8log eapprox 3.47$, and so it is decreasing for $x>8log e$. Thus when you have found $nge 4$ satisfying the inequality, with $n+1$ not satisfying it, you're done.
We have $8log 6approx6.22>6$ and $8log 7approx6.76<7$.
$endgroup$
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
add a comment |
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%2f3044371%2ffind-n-in-a-log-equation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You have a wrong simplification: the inequality $8n^2<64nlog n$ becomes
$$
n<8log n
$$
You can check that the function $f(x)=8log x-x$ has a maximum at $8log eapprox 3.47$, and so it is decreasing for $x>8log e$. Thus when you have found $nge 4$ satisfying the inequality, with $n+1$ not satisfying it, you're done.
We have $8log 6approx6.22>6$ and $8log 7approx6.76<7$.
$endgroup$
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
add a comment |
$begingroup$
You have a wrong simplification: the inequality $8n^2<64nlog n$ becomes
$$
n<8log n
$$
You can check that the function $f(x)=8log x-x$ has a maximum at $8log eapprox 3.47$, and so it is decreasing for $x>8log e$. Thus when you have found $nge 4$ satisfying the inequality, with $n+1$ not satisfying it, you're done.
We have $8log 6approx6.22>6$ and $8log 7approx6.76<7$.
$endgroup$
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
add a comment |
$begingroup$
You have a wrong simplification: the inequality $8n^2<64nlog n$ becomes
$$
n<8log n
$$
You can check that the function $f(x)=8log x-x$ has a maximum at $8log eapprox 3.47$, and so it is decreasing for $x>8log e$. Thus when you have found $nge 4$ satisfying the inequality, with $n+1$ not satisfying it, you're done.
We have $8log 6approx6.22>6$ and $8log 7approx6.76<7$.
$endgroup$
You have a wrong simplification: the inequality $8n^2<64nlog n$ becomes
$$
n<8log n
$$
You can check that the function $f(x)=8log x-x$ has a maximum at $8log eapprox 3.47$, and so it is decreasing for $x>8log e$. Thus when you have found $nge 4$ satisfying the inequality, with $n+1$ not satisfying it, you're done.
We have $8log 6approx6.22>6$ and $8log 7approx6.76<7$.
answered Dec 17 '18 at 22:24
egregegreg
182k1486204
182k1486204
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
add a comment |
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
Forgive me for my question, but why did you use log$e$?
$endgroup$
– Evan Kim
Dec 18 '18 at 0:45
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
$begingroup$
@EvanKim Because the logarithm is in base 10.
$endgroup$
– egreg
Dec 18 '18 at 7:44
add a comment |
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%2f3044371%2ffind-n-in-a-log-equation%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
2
$begingroup$
You divided by 64 not by 64n.
$endgroup$
– hamam_Abdallah
Dec 17 '18 at 20:01
$begingroup$
I can't divide by 64n because I canceled n in 64n out in the first step
$endgroup$
– Evan Kim
Dec 17 '18 at 20:05
2
$begingroup$
@EvanKim $frac n8=log n$
$endgroup$
– Shubham Johri
Dec 17 '18 at 20:11
$begingroup$
Oh I see it now
$endgroup$
– Evan Kim
Dec 17 '18 at 20:13