MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / lower_bound

Method lower_bound

Strings/Suffix Array.cpp:146–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 return query(l, r - 1);
145 }
146 int lower_bound(string &t) {
147 int l = 0, r = n - 1, k = t.size(), ans = n;
148 while (l <= r) {
149 int mid = l + r >> 1;
150 if (s.substr(sa[mid], min(n - sa[mid], k)) >= t) ans = mid, r = mid - 1;
151 else l = mid + 1;
152 }
153 return ans;
154 }
155 int upper_bound(string &t) {
156 int l = 0, r = n - 1, k = t.size(), ans = n;
157 while (l <= r) {

Callers 6

insideFunction · 0.80
any_intersectionFunction · 0.80
kth_digitMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80
assignMethod · 0.80

Calls 2

sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected