Skip to content

Commit

Permalink
Use Latex in 'Union find' section
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh committed Oct 26, 2019
1 parent 1e39a1a commit a4afb1f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The key union-find operations are:

Union-find represents sets as a **backwards tree**, where each node has a corresponding parent. The root node defines which set the node and all its children are in.

A root node has its parent set to itself, to identify that it's the root in a set. {% cite algorithm-design-manual -l 199 %}.
A root node has its parent set to itself, to identify that it's the root in a set {% cite algorithm-design-manual -l 199 %}.

<figure>
<img src="{{site.baseurl}}/assets/img/data-structures-and-algorithms/data-structures/union-find/union-find.svg" alt="">
Expand All @@ -42,7 +42,7 @@ A root node has its parent set to itself, to identify that it's the root in a se

Merging sets can be done by setting the parent of one set to the parent of another. In the case of a merge, the smallest subtree becomes the parent of the other {% cite algorithm-design-manual -l 199 %}.

At most lg2n doublings can occur before all sets have been merged. That means `find` and `union` are both O(log n) operations {% cite algorithm-design-manual -l 201 %}.
At most $$lg_2 n$$ doublings can occur before all sets have been merged. That means `find` and `union` are both $$O(log n)$$ operations {% cite algorithm-design-manual -l 201 %}.

## Representing a union-find

Expand Down

0 comments on commit a4afb1f

Please sign in to comment.