ThomaFM / ucfjv

Hackpack for UCF Junior Varsity/Developmental Team
5 stars 0 forks source link

adding lca struct for O(log(n)) lca and dist queries #40

Closed ThomaFM closed 1 month ago

ThomaFM commented 1 month ago

struct based lca, includes dist function since it is commonly used. particularly long (62 character) initialization line might need to be refined later.

Summary

Includes lca and dist function. Initializes LCA structure allowing for lowest common ancestor queries given a (undirected) zero based adjacency list representing a tree. Tree is rooted at 0 by default (perhaps a parameter may be desirable?)

Submission Link/Screenshots

https://cses.fi/problemset/result/10795064/ image

Checklist

azurerazor commented 1 month ago

also forgot to mention that the filename should probably be all caps (LCA instead of lca)