Skip to content

5 data structure disjoint set union#148

Open
110souhei wants to merge 4 commits into
mainfrom
5-data-structure-disjoint-set-union
Open

5 data structure disjoint set union#148
110souhei wants to merge 4 commits into
mainfrom
5-data-structure-disjoint-set-union

Conversation

@110souhei
Copy link
Copy Markdown
Collaborator

No description provided.

@110souhei 110souhei requested a review from Luzhiled July 12, 2023 11:02
Comment on lines +8 to +9
using isize = ptrdiff_t;
using usize = size_t;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多分僕のライブラリから持ってきていると思うんですが、普通に int でやってもらったほうがいいと思う

Comment on lines +10 to +12
size_t n_;

vector<ptrdiff_t> vals_;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ 外してください

Comment on lines +13 to +20
void bound_check(size_t v) const{
assert(v < n_);
}

size_t impl_leader(size_t v){
if( vals_[v] < 0 ) return v;
return vals_[v] = leader(vals_[v]);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これも消してくれると助かる

assert は各メソッドに入れてください

Comment on lines +26 to +28
size_t size() const{
return n_;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これもいらないかな

return x;
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// === no need to implement from here ===

みたいなものを入れておいてください

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんか全体的に tab 幅とかがおかしいと思うので space 2 つにしておいてもらえると助かります

size_t -> int
tab -> space
@110souhei 110souhei requested a review from Luzhiled July 15, 2023 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants