Complexity of many constant time steps with occasional logarithmic stepsUpper-bounding the number of comparisons for Sorting to $Theta(n)$ using a physically big number like Number of Particles in the UniverseWhy does this mergesort variant not do Θ(n) comparisons on average?Why does the total credit associated with a data structure must be nonnegative at all times for the accounting method?How does the token method of amortized analysis work in this example?In Amortized Analysis, can we chose how big $n$ is?Incremental strongly connected componentsThe validity of the potential function for splay treeClock page replacement policy vs LRU page replacement policy, is Clock more efficient?if binary heap potential function is c*size(binary heap)) then insert will not take O(logn)and extract min will not take O(1) amortized timeMergable heap with no key knowledge cannot EXTRACT-MIN in $o(log n)$ amortized time

Numerical second order differentiation

How can a flywheel makes engine runs smoothly?

What is the context for Napoleon's quote "[the Austrians] did not know the value of five minutes"?

How do I run a script as sudo at boot time on Ubuntu 18.04 Server?

Redirecting output only on a successful command call

Having some issue with notation in a Hilbert space

The instant an accelerating object has zero speed, is it speeding up, slowing down, or neither?

How can the US president give an order to a civilian?

Converting 3x7 to a 1x7. Is it possible with only existing parts?

New Site Design!

Co-worker is now managing my team. Does this mean that I'm being demoted?

Is swap gate equivalent to just exchanging the wire of the two qubits?

Is it a bad idea to have a pen name with only an initial for a surname?

What is this plant I saw for sale at a Romanian farmer's market?

Background for black and white chart

How to sort human readable size

How could I create a situation in which a PC has to make a saving throw or be forced to pet a dog?

Time at 1G acceleration to travel 100000 light years

How can I detect if I'm in a subshell?

Digital signature that is only verifiable by one specific person

Is this set open or closed (or both?)

SQL Server has encountered occurences of I/O requests taking longer than 15 seconds

What do I put on my resume to make the company i'm applying to think i'm mature enough to handle a job?

Do my partner and son need an SSN to be dependents on my taxes?



Complexity of many constant time steps with occasional logarithmic steps


Upper-bounding the number of comparisons for Sorting to $Theta(n)$ using a physically big number like Number of Particles in the UniverseWhy does this mergesort variant not do Θ(n) comparisons on average?Why does the total credit associated with a data structure must be nonnegative at all times for the accounting method?How does the token method of amortized analysis work in this example?In Amortized Analysis, can we chose how big $n$ is?Incremental strongly connected componentsThe validity of the potential function for splay treeClock page replacement policy vs LRU page replacement policy, is Clock more efficient?if binary heap potential function is c*size(binary heap)) then insert will not take O(logn)and extract min will not take O(1) amortized timeMergable heap with no key knowledge cannot EXTRACT-MIN in $o(log n)$ amortized time






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


I have a data structure that can perform a task $T$ in constant time, $O(1)$. However, every $k$th invocation requires $O(logn)$, where $k$ is constant.



Is it possible for this task to ever take amortized constant time, or is it impossible because the logarithm will eventually become greater than $k$?



If an upper bound for $n$ is known as $N$, can $k$ be chosen to be less than $logN$?










share|cite|improve this question











$endgroup$







  • 2




    $begingroup$
    It depends on how $k$ relates to $n$. For instance $k=2$ then this will not matter and $n$ operations will take $O(n log n)$. If $k = n$ then after $n$ operations we have time $O(n + log n)$. How does $k$ relate to $n$?
    $endgroup$
    – ryan
    Apr 14 at 20:09










  • $begingroup$
    @ryan k is constant. (I have edited the question to specify this)
    $endgroup$
    – rtheunissen
    Apr 14 at 21:04


















3












$begingroup$


I have a data structure that can perform a task $T$ in constant time, $O(1)$. However, every $k$th invocation requires $O(logn)$, where $k$ is constant.



Is it possible for this task to ever take amortized constant time, or is it impossible because the logarithm will eventually become greater than $k$?



If an upper bound for $n$ is known as $N$, can $k$ be chosen to be less than $logN$?










share|cite|improve this question











$endgroup$







  • 2




    $begingroup$
    It depends on how $k$ relates to $n$. For instance $k=2$ then this will not matter and $n$ operations will take $O(n log n)$. If $k = n$ then after $n$ operations we have time $O(n + log n)$. How does $k$ relate to $n$?
    $endgroup$
    – ryan
    Apr 14 at 20:09










  • $begingroup$
    @ryan k is constant. (I have edited the question to specify this)
    $endgroup$
    – rtheunissen
    Apr 14 at 21:04














3












3








3


3



$begingroup$


I have a data structure that can perform a task $T$ in constant time, $O(1)$. However, every $k$th invocation requires $O(logn)$, where $k$ is constant.



Is it possible for this task to ever take amortized constant time, or is it impossible because the logarithm will eventually become greater than $k$?



If an upper bound for $n$ is known as $N$, can $k$ be chosen to be less than $logN$?










share|cite|improve this question











$endgroup$




I have a data structure that can perform a task $T$ in constant time, $O(1)$. However, every $k$th invocation requires $O(logn)$, where $k$ is constant.



Is it possible for this task to ever take amortized constant time, or is it impossible because the logarithm will eventually become greater than $k$?



If an upper bound for $n$ is known as $N$, can $k$ be chosen to be less than $logN$?







algorithm-analysis runtime-analysis amortized-analysis






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Apr 14 at 21:06







rtheunissen

















asked Apr 14 at 19:13









rtheunissenrtheunissen

1416




1416







  • 2




    $begingroup$
    It depends on how $k$ relates to $n$. For instance $k=2$ then this will not matter and $n$ operations will take $O(n log n)$. If $k = n$ then after $n$ operations we have time $O(n + log n)$. How does $k$ relate to $n$?
    $endgroup$
    – ryan
    Apr 14 at 20:09










  • $begingroup$
    @ryan k is constant. (I have edited the question to specify this)
    $endgroup$
    – rtheunissen
    Apr 14 at 21:04













  • 2




    $begingroup$
    It depends on how $k$ relates to $n$. For instance $k=2$ then this will not matter and $n$ operations will take $O(n log n)$. If $k = n$ then after $n$ operations we have time $O(n + log n)$. How does $k$ relate to $n$?
    $endgroup$
    – ryan
    Apr 14 at 20:09










  • $begingroup$
    @ryan k is constant. (I have edited the question to specify this)
    $endgroup$
    – rtheunissen
    Apr 14 at 21:04








2




2




$begingroup$
It depends on how $k$ relates to $n$. For instance $k=2$ then this will not matter and $n$ operations will take $O(n log n)$. If $k = n$ then after $n$ operations we have time $O(n + log n)$. How does $k$ relate to $n$?
$endgroup$
– ryan
Apr 14 at 20:09




$begingroup$
It depends on how $k$ relates to $n$. For instance $k=2$ then this will not matter and $n$ operations will take $O(n log n)$. If $k = n$ then after $n$ operations we have time $O(n + log n)$. How does $k$ relate to $n$?
$endgroup$
– ryan
Apr 14 at 20:09












$begingroup$
@ryan k is constant. (I have edited the question to specify this)
$endgroup$
– rtheunissen
Apr 14 at 21:04





$begingroup$
@ryan k is constant. (I have edited the question to specify this)
$endgroup$
– rtheunissen
Apr 14 at 21:04











1 Answer
1






active

oldest

votes


















8












$begingroup$

If every $k$th operation takes $O(log n)$ time, then the best bound you can get on the amortized complexity is $O(1 + fraclog nk)$. This follows from the definition of amortized complexity.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
    $endgroup$
    – rtheunissen
    Apr 14 at 21:05






  • 8




    $begingroup$
    If $k$ is constant, the amortized complexity is $O(log n)$.
    $endgroup$
    – Yuval Filmus
    Apr 14 at 21:07










  • $begingroup$
    @YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
    $endgroup$
    – Frank Hopkins
    Apr 14 at 23:46










  • $begingroup$
    Of course, I just mean the cost of the task itself.
    $endgroup$
    – rtheunissen
    Apr 15 at 0:14











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "419"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f106957%2fcomplexity-of-many-constant-time-steps-with-occasional-logarithmic-steps%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









8












$begingroup$

If every $k$th operation takes $O(log n)$ time, then the best bound you can get on the amortized complexity is $O(1 + fraclog nk)$. This follows from the definition of amortized complexity.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
    $endgroup$
    – rtheunissen
    Apr 14 at 21:05






  • 8




    $begingroup$
    If $k$ is constant, the amortized complexity is $O(log n)$.
    $endgroup$
    – Yuval Filmus
    Apr 14 at 21:07










  • $begingroup$
    @YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
    $endgroup$
    – Frank Hopkins
    Apr 14 at 23:46










  • $begingroup$
    Of course, I just mean the cost of the task itself.
    $endgroup$
    – rtheunissen
    Apr 15 at 0:14















8












$begingroup$

If every $k$th operation takes $O(log n)$ time, then the best bound you can get on the amortized complexity is $O(1 + fraclog nk)$. This follows from the definition of amortized complexity.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
    $endgroup$
    – rtheunissen
    Apr 14 at 21:05






  • 8




    $begingroup$
    If $k$ is constant, the amortized complexity is $O(log n)$.
    $endgroup$
    – Yuval Filmus
    Apr 14 at 21:07










  • $begingroup$
    @YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
    $endgroup$
    – Frank Hopkins
    Apr 14 at 23:46










  • $begingroup$
    Of course, I just mean the cost of the task itself.
    $endgroup$
    – rtheunissen
    Apr 15 at 0:14













8












8








8





$begingroup$

If every $k$th operation takes $O(log n)$ time, then the best bound you can get on the amortized complexity is $O(1 + fraclog nk)$. This follows from the definition of amortized complexity.






share|cite|improve this answer









$endgroup$



If every $k$th operation takes $O(log n)$ time, then the best bound you can get on the amortized complexity is $O(1 + fraclog nk)$. This follows from the definition of amortized complexity.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Apr 14 at 20:29









Yuval FilmusYuval Filmus

202k15197359




202k15197359











  • $begingroup$
    Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
    $endgroup$
    – rtheunissen
    Apr 14 at 21:05






  • 8




    $begingroup$
    If $k$ is constant, the amortized complexity is $O(log n)$.
    $endgroup$
    – Yuval Filmus
    Apr 14 at 21:07










  • $begingroup$
    @YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
    $endgroup$
    – Frank Hopkins
    Apr 14 at 23:46










  • $begingroup$
    Of course, I just mean the cost of the task itself.
    $endgroup$
    – rtheunissen
    Apr 15 at 0:14
















  • $begingroup$
    Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
    $endgroup$
    – rtheunissen
    Apr 14 at 21:05






  • 8




    $begingroup$
    If $k$ is constant, the amortized complexity is $O(log n)$.
    $endgroup$
    – Yuval Filmus
    Apr 14 at 21:07










  • $begingroup$
    @YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
    $endgroup$
    – Frank Hopkins
    Apr 14 at 23:46










  • $begingroup$
    Of course, I just mean the cost of the task itself.
    $endgroup$
    – rtheunissen
    Apr 15 at 0:14















$begingroup$
Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
$endgroup$
– rtheunissen
Apr 14 at 21:05




$begingroup$
Does that mean that if k is constant, the amortized complexity is O(1 + (log n / k))?
$endgroup$
– rtheunissen
Apr 14 at 21:05




8




8




$begingroup$
If $k$ is constant, the amortized complexity is $O(log n)$.
$endgroup$
– Yuval Filmus
Apr 14 at 21:07




$begingroup$
If $k$ is constant, the amortized complexity is $O(log n)$.
$endgroup$
– Yuval Filmus
Apr 14 at 21:07












$begingroup$
@YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
$endgroup$
– Frank Hopkins
Apr 14 at 23:46




$begingroup$
@YuvalFilmus might want to note that this is per step, the overall complexity cannot be better than O(n)
$endgroup$
– Frank Hopkins
Apr 14 at 23:46












$begingroup$
Of course, I just mean the cost of the task itself.
$endgroup$
– rtheunissen
Apr 15 at 0:14




$begingroup$
Of course, I just mean the cost of the task itself.
$endgroup$
– rtheunissen
Apr 15 at 0:14

















draft saved

draft discarded
















































Thanks for contributing an answer to Computer Science 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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f106957%2fcomplexity-of-many-constant-time-steps-with-occasional-logarithmic-steps%23new-answer', 'question_page');

);

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







Popular posts from this blog

Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü