Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(534)

Issue 13066044: Inv

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by guspiel
Modified:
12 years, 1 month ago
Reviewers:
robryk
Visibility:
Public.

Description

Inv

Patch Set 1 #

Total comments: 6

Patch Set 2 : Line break #

Patch Set 3 : Reply to the three inline comments #

Total comments: 45

Patch Set 4 : Responding to comments #

Total comments: 24
Unified diffs Side-by-side diffs Delta from patch set Stats (+471 lines, -0 lines) Patch
A inv.cpp View 1 2 3 1 chunk +299 lines, -0 lines 0 comments Download
A per.tex View 1 2 3 1 chunk +172 lines, -0 lines 24 comments Download

Messages

Total messages: 6
guspiel
12 years, 1 month ago (2013-08-24 09:52:50 UTC) #1
robryk
Polam prosze linijki z tekstem, izby latwiej sie bylo odnosic do czegos innego niz caly ...
12 years, 1 month ago (2013-08-24 09:56:33 UTC) #2
guspiel
https://codereview.appspot.com/13066044/diff/1/per.tex File per.tex (right): https://codereview.appspot.com/13066044/diff/1/per.tex#newcode68 per.tex:68: To simplify the notation, we will write $a \in ...
12 years, 1 month ago (2013-08-24 10:12:33 UTC) #3
robryk
No comments to code yet. https://codereview.appspot.com/13066044/diff/7001/per.tex File per.tex (right): https://codereview.appspot.com/13066044/diff/7001/per.tex#newcode54 per.tex:54: Limiting the numbers that ...
12 years, 1 month ago (2013-08-24 10:39:54 UTC) #4
guspiel
https://codereview.appspot.com/13066044/diff/7001/per.tex File per.tex (right): https://codereview.appspot.com/13066044/diff/7001/per.tex#newcode54 per.tex:54: Limiting the numbers that can be stored in our ...
12 years, 1 month ago (2013-08-24 18:11:51 UTC) #5
robryk
12 years, 1 month ago (2013-08-25 14:15:16 UTC) #6
Still no code comments, I've just looked quickly through it.

https://codereview.appspot.com/13066044/diff/10001/per.tex
File per.tex (right):

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode52
per.tex:52: We assume the permutation is given by an array in which the i-th
element denotes the value at i.
I'd rephrase:
Let's consider a permutation given by an array...

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode53
per.tex:53: Finding its inverse can be achieved in linear time and constant
memory with a simple cycle leader [TODO: citation] algorithm.
1. Seems untrue (the cycle leader stuff had exp runtime of nlgn and didn't use
overly large array elements, right?).
2. We care about constant additional memory.
3. Explain what kind of constant additional memory you mean (constant number of
log-sized words is a good way to say that) and what kind of additional memory
(array constrained to hold values from [n], but _not_ constrained to hold
permutations).

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode62
per.tex:62: Also: a path is defined as a sequence of distinct vertices $(a_0,
a_1, ..., a_{m})$ such that $t[a_i]=a_{i+1}$ for $i \in [m-1]$,
Introduce definitons. Extraneous also.

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode70
per.tex:70: \item excluding the $t$ array, this is a constant memory algorithm.
.. uses a constant number of additional log-sized words?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode73
per.tex:73: The algorithm has three phases - each is an iteration over the
vertices in order of increasing indices and doing something for every one.
`doing something' extraneous
Prop: each iterates...

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode74
per.tex:74: As we aim at an $O(n^{\frac{3}{2}})$ algorithm, we can afford to
walk each cycle of size $O(\sqrt{n})$ for each of their vertices.
nitpick: its vertices

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode75
per.tex:75: For larger cycles, we do something to them at first visit so that
they are processed only once.
s/do something/modify/?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode76
per.tex:76: So let $k = \lceil \sqrt{n} \rceil$ and $4k+1$ be the length of the
largest cycle that we will walk multiple times.
... Let's call all cycles of length <=4k+1 small cycles and the rest large
cycles. Each small cycle we will walk every time we encounter one of its
vertices. For large cycles....
?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode80
per.tex:80: assume a trivial linear memory implementation of functions
$storeSegmentSize$ and $retrieveSegmentSize$.
Write it out explicitely in the pseudocode?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode81
per.tex:81: After proving the correctness and the time boundary, we will present
their constant memory implementations in the annotated lines.
...and prove that using those implementations preserves the correctness and time
complexity?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode83
per.tex:83: In order to mark a large cycle as visited, we will divide it into
"segments" by redirecting some edges.
What it the point of marking as visited? This is the first time `marking as
visited' is mentioned. Sugg: rephrase the statement about avoidance of multiple
walks over large cycles.

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode85
per.tex:85: We are doing this for two reasons.
Doesn't flow. Define a segment earlier, when defining path, and provide a figure
with a sample path, cycle and segment?

Segment size limits missing, following sentences assume reader knows segments
are O(sqrt(n)) in size.

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode88
per.tex:88: So please assume the following definition: a sequence of vertices
$\sequencen{a}{m}$ forms a segment iff
``So please assume'' weird phrasing

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode93
per.tex:93: Now consider segments of size $2k$.
at most?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode94
per.tex:94: Please note that there are at most $k^2$ such segments up to
isomorphism.
at most? it's obviously O(k^2), but seems to be k(2k-1) rather than k^2.

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode95
per.tex:95: Thanks to the choice of $k$ this means that segments can encode
vertex numbers.
a segment (maybe: segment's shape?) can encode a vertex number

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode96
per.tex:96: This encoding and its inverse are implemented in functions $encode$
and $decode$, respectively.
are implemented, respectively, in ...

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode103
per.tex:103: The structure is the inverse of the cycle with some modifications
that allow us both to recognize that this cycle was visited and to repair the
cycle later.
s/repair/reconstruct/?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode104
per.tex:104: The second pass over the array happens in the function
$repairLargeCycles$, in which the intermediary structure is removed, leaving the
large cycles inverted.
converted into the inverted original large cycle?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode113
per.tex:113: If yes, the number of vertices in the segment and the length of the
segment's cycle are returned.
nitpick: If so?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode121
per.tex:121: The function's running time is linear in the segment size. It
follows from the definition of a segment that this is equivalent to
$O(\sqrt{n})$.
nitpick: not equivalent

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode128
per.tex:128: \item $0 \leq b_0 < b_1 < b_2 < ... < b_{k-1} < b_k = m$,
0 \leq b_0 and not 0 = b_0? Else what happens with t[a[0]], t[a[1]], ...,
t[a[b_0-1]]?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode156
per.tex:156: Function $repairCycle$ is called exactly once for each large cycle
from the input, always with $i$ set to the smallest vertex on the cycle.
input isn't the functions input. Maybe name the intermediate structure somehow
and use its name a.o. here?

https://codereview.appspot.com/13066044/diff/10001/per.tex#newcode163
per.tex:163: The function inverts every small cycle and does nothing more.
weird phrasing: `does nothing more'
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b