y-cruncher | Bug-Tracking and open-sourced parts of y-cruncher | Augmented Reality library
kandi X-RAY | y-cruncher Summary
kandi X-RAY | y-cruncher Summary
Bug-Tracking and open-sourced parts of y-cruncher.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of y-cruncher
y-cruncher Key Features
y-cruncher Examples and Code Snippets
Community Discussions
Trending Discussions on y-cruncher
QUESTION
I'm getting this error when running a multi-threading library on Docker.
...ANSWER
Answered 2019-Mar-16 at 22:46It looks like an app issue. Non docker execution has the same problem:
QUESTION
(edit: the question that my question has been flagged a duplicate of was already linked in my original post, even before the flagging, and I did not consider it sufficient to answer my specific question, why was how to get a certain complexity without making any assumptions about an unknown function.)
I'm trying to solve exercise in CLRS (Cormen Intro to Algorithms, 3ed). The exercise reads:
Give an efficient algorithm to convert a given β-bit (binary) integer to a decimal representation. Argue that if multiplication or division of integers whose length is at most β takes time M(β), then we can convert binary to decimal in time Θ[M(β)lgβ]. (Hint: Use a divide-and-conquer approach, obtaining the top and bottom halves of the result with separate recursions).
This question has been asked here, and here. However, the answers there either make incorrect assumptions, such as M(β)=O(β), or give an answer the completely ignores what the question is asking for. Another answer here even explicitly states the Θ[M(β)lgβ] result, but the explanation is quite handwavey, as if the result were obvious:
You can do base conversion in O(M(n) log(n)) time, however, by picking a power of target-base that's roughly the square root of the to-be-converted number, doing divide-and-remainder by it (which can be done in O(M(n)) time via Newton's method), and recursing on the two halves.
That explanation was not entirely clear to me: without making any assumptions about M(n), such a recursion would result in O(M(n) n) time, not O(M(n) log(n)). (edit: my question has been marked a duplicate of that thread, but I had already included the link to that thread in my original post, before it was marked as duplicate, as I feel that the answer to that thread did not sufficiently address the issue I was confused about).
As I understand, the question is saying that each multiplication, quotient, and remainder operation takes a constant time M, which dominates every other kind of operation, such as addition. Hence, the dominant term M(β)lgβ comes simply from performing only lgβ multiplications and divisions.
However, I am not able to come up with anything that requires only lgβ divisions. For example, if we take the hint from the question, we can come up with the following divide and conquer algorithm, in pseudocode.
...ANSWER
Answered 2017-Dec-26 at 01:54First, to get it out of the way: what the title of my question is asking for, to make the conversion with a logarithmic number of divisions and multiplications, is not possible as far as I know; and that was only an assumption I made based on a misunderstanding of a reading of the question.
I corresponded with the authors of the textbook Modern Computer Arithmetic, and they said that the algorithm indeed calls division Θ(β) times, not Θ( lg β), and at deeper recursive levels, M does in fact act on smaller-sized arguments, not on the constant, top-level β as I had incorrectly assumed in my question. In particular, the tree's top level call has M(β/2), the next level has 2M(β/4), then 4M(β/8), etc. for a total of lg β levels. As long as M(β) = Ω(β), the tree summation is O(M(β) lg β), though in general not Ω(M(β) lgβ), and hence not Θ(M(β) lgβ). For example, for polynomial M(β) = Θ(β^α), the tree summation is Θ(β lg β) = Θ(M(β) lg β) for α = 1, and Θ(β^α) = Θ(M(β)) for α > 1.
Hence, if we only assume M(β) = Ω(β), then the runtime would more accurately be described as O(M(β) lg β), not Θ(M(β) lg β) as in the CLRS exercise. (In my correspondance with one of the authors of Modern Computer Arithmetic, they suggested that CLRS meant that "give an efficient algorithm" meant to assume M(β) is linear or quasilinear, but CLRS is usually pretty explicit about the assumptions we are supposed to make, and "give an efficient algorithm" is just a somewhat generic phrase that they use pretty often in the text to exercises and problems, so I feel like this might be a minor typo on the part of CLRS.
Update: I submitted this minor correction to the CLRS errata page, and it is up now:
Page 933, Exercise 31.1-13. Add the restriction that M(β) = Ω(β), and change the desired time bound from Θ(M(β) lg β) to O(M(β) lg β). Reported by David Liu. Posted 25 December 2017. Severity level: 3 To be corrected in the eighth printing of the third edition.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install y-cruncher
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page