Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
ds2-notes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
datovky
ds2-notes
Commits
9744cd1b
Commit
9744cd1b
authored
4 years ago
by
Parth Mittal
Browse files
Options
Downloads
Patches
Plain Diff
typset algorithm better
parent
5d2b3d02
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
streaming/streaming.tex
+10
-8
10 additions, 8 deletions
streaming/streaming.tex
with
10 additions
and
8 deletions
streaming/streaming.tex
+
10
−
8
View file @
9744cd1b
...
@@ -42,18 +42,16 @@ of each element in a stream of integers. We shall see that it also provides
...
@@ -42,18 +42,16 @@ of each element in a stream of integers. We shall see that it also provides
us with a small set
$
C
$
containing
$
F
_
k
$
, and hence lets us solve the frequent
us with a small set
$
C
$
containing
$
F
_
k
$
, and hence lets us solve the frequent
elements problem efficiently.
elements problem efficiently.
TODO: Typeset the algorithm better.
\algo
{
FrequencyEstimate
}
\algalias
{
Misra/Gries Algorithm
}
\proc
{
FrequencyEstimate
}$
(
\alpha
, k
)
$
\algin
the data stream
$
\alpha
$
, the target for the estimator
$
k
$
\algin
the data stream
$
\alpha
$
, the target for the estimator
$
k
$
\:\em
{
Init
}
:
$
A
\=
\emptyset
$
.
(
an empty map
)
\:\em
{
Init
}
:
$
A
\=
\emptyset
$
.
\cmt
{
an empty map
}
\:\em
{
Process
}
(
$
x
$
):
\:\em
{
Process
}
(
$
x
$
):
\:
If
$
x
\in
$
keys(
$
A
$
),
$
A
[
x
]
\=
A
[
x
]
+
1
$
.
\:
:
If
$
x
\in
$
keys(
$
A
$
),
$
A
[
x
]
\=
A
[
x
]
+
1
$
.
\:
Else If
$
\vert
$
keys(
$
A
$
)
$
\vert
< k
-
1
$
,
$
A
[
x
]
\=
1
$
.
\:
:
Else If
$
\vert
$
keys(
$
A
$
)
$
\vert
< k
-
1
$
,
$
A
[
x
]
\=
1
$
.
\:
Else
\:
:
Else
\forall
$
a
\in
$
~keys(
$
A
$
):
$
A
[
a
]
\=
A
[
a
]
-
1
$
,
\forall
$
a
\in
$
~keys(
$
A
$
):
$
A
[
a
]
\=
A
[
a
]
-
1
$
,
delete
$
a
$
from
$
A
$
if
$
A
[
a
]
=
0
$
.
delete
$
a
$
from
$
A
$
if
$
A
[
a
]
=
0
$
.
\
:\em
{
Output
}
:
$
\hat
{
f
}_
a
=
A
[
a
]
$
If
$
a
\in
$
~keys(
$
A
$
), and
$
\hat
{
f
}_
a
=
0
$
otherwise.
\
algout
$
\hat
{
f
}_
a
=
A
[
a
]
$
If
$
a
\in
$
~keys(
$
A
$
), and
$
\hat
{
f
}_
a
=
0
$
otherwise.
\endalgo
\endalgo
Let us show that
$
\hat
{
f
}_
a
$
is a good estimate for the frequency
$
f
_
a
$
.
Let us show that
$
\hat
{
f
}_
a
$
is a good estimate for the frequency
$
f
_
a
$
.
...
@@ -95,6 +93,10 @@ $\vert C \vert = \vert$keys($A$)$\vert \leq k - 1$, and a key-value pair can
...
@@ -95,6 +93,10 @@ $\vert C \vert = \vert$keys($A$)$\vert \leq k - 1$, and a key-value pair can
be stored in
$
\O
(
\log
n
+
\log
m
)
$
bits.
be stored in
$
\O
(
\log
n
+
\log
m
)
$
bits.
\qed
\qed
\subsection
{
The Count-Min sketch
}
We will now look at a randomized streaming algorithm that performs the same task
\endchapter
\endchapter
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment