Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Automatically Removed Whitespace #1

Open
wants to merge 1 commit into from

0 participants

@GunioRobot

Hi there!

This is WhitespaceBot. I'm an open-source robot that removes trailing white space in your code.

Why whitespace? Whitespace is an eyesore for developers who use text editors with dark themes. It's not a huge deal, but it's a bit annoying if you use Vim in a terminal. Really, I'm just a proof of concept - GitHub's V3 API allows robots to automatically improve open source projects, and that's really cool. Hopefully, somebody, maybe you!, will fork me and make me even more useful.

I've only cleaned your most popular project, and I've added you to a list of users not to contact again, so you won't get any more pull requests from me unless you ask. If I'm misbehaving, please email my owner and tell him to turn me off! If this is pull request is of no use to you, please just ignore it.

Thanks!
WhitespaceBot.

Gun.io Whitespace Robot Remove whitespace [WhitespaceBot] e474d7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2012
  1. Remove whitespace [WhitespaceBot]

    Gun.io Whitespace Robot authored
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 12 deletions.
  1. +9 −9 DisjointSet.cpp
  2. +2 −2 DisjointSet.h
  3. +1 −1  README
View
18 DisjointSet.cpp
@@ -1,6 +1,6 @@
#include "DisjointSet.h"
-DisjointSet::DisjointSet()
+DisjointSet::DisjointSet()
:numElts(0), numSets(0) {}
DisjointSet::DisjointSet(const DisjointSet &d) {
@@ -37,7 +37,7 @@ int DisjointSet::Find(int elt) {
Dnode* root = nodes[elt];
- while (root->parent != NULL)
+ while (root->parent != NULL)
root = root->parent;
Dnode* setIter = nodes[elt];
@@ -52,14 +52,14 @@ int DisjointSet::Find(int elt) {
void DisjointSet::Union(int set1, int set2) {
assert(set1 < numElts && set2 < numElts);
-
+
Dnode* set1_rep = nodes[Find(set1)];
Dnode* set2_rep = nodes[Find(set2)];
- if (set1_rep == set2_rep)
+ if (set1_rep == set2_rep)
return;
- if (set1_rep->rank < set2_rep->rank)
+ if (set1_rep->rank < set2_rep->rank)
set1_rep->parent = set2_rep;
else if (set1_rep->rank > set2_rep->rank)
set2_rep->parent = set1_rep;
@@ -67,7 +67,7 @@ void DisjointSet::Union(int set1, int set2) {
set2_rep->parent = set1_rep; // arbitrary, set1_rep->parent = set2->rep
set1_rep->rank += 1;
}
-
+
--numSets;
}
@@ -82,7 +82,7 @@ int DisjointSet::NumSets() const {
DisjointSet::~DisjointSet() {
for (int i=0; i<numElts; i++)
delete nodes[i];
-
+
nodes.clear();
}
@@ -91,10 +91,10 @@ void DisjointSet::copyAll(const DisjointSet &d) {
this->numSets = d.numSets;
nodes.resize(numElts);
- for (int i=0; i<numElts; i++)
+ for (int i=0; i<numElts; i++)
nodes[i] = new Dnode(*d.nodes[i]);
- for (int i=0; i<numElts; i++)
+ for (int i=0; i<numElts; i++)
if (d.nodes[i]->parent != NULL)
nodes[i]->parent = nodes[d.nodes[i]->parent->index];
}
View
4 DisjointSet.h
@@ -14,14 +14,14 @@ class DisjointSet {
int Find(int element);
int NumElements() const;
int NumSets() const;
-
+
private:
void copyAll(const DisjointSet &d);
struct Dnode {
int index; // index of the elment the node represents
int rank;
- Dnode* parent;
+ Dnode* parent;
Dnode() {
parent = NULL;
View
2  README
@@ -1,4 +1,4 @@
-A simple implementation of the Disjoint Data Structure (Union Find) that is has
+A simple implementation of the Disjoint Data Structure (Union Find) that is has
interesting characteristics as seen here: http://en.wikipedia.org/wiki/Disjoint-set_data_structure
From this point on?
Something went wrong with that request. Please try again.