46 cout <<
"=== Meeting Scheduler ===" <<
endl;
57 cout <<
"Existing meetings:" <<
endl;
59 cout <<
" [" <<
iv.low / 60 <<
":"
60 << (
iv.low % 60 < 10 ?
"0" :
"") <<
iv.low % 60
61 <<
" - " <<
iv.high / 60 <<
":"
62 << (
iv.high % 60 < 10 ?
"0" :
"") <<
iv.high % 60
68 cout <<
"\nProposed meeting: 14:00 - 15:00" <<
endl;
72 cout <<
" No conflicts! Meeting can be scheduled." <<
endl;
75 cout <<
" Conflicts with:" <<
endl;
77 cout <<
" [" <<
iv.low / 60 <<
":"
78 << (
iv.low % 60 < 10 ?
"0" :
"") <<
iv.low % 60
79 <<
" - " <<
iv.high / 60 <<
":"
80 << (
iv.high % 60 < 10 ?
"0" :
"") <<
iv.high % 60
86 cout <<
"\nStabbing query: what meetings are at 14:30?" <<
endl;
89 cout <<
" [" <<
iv.low / 60 <<
":"
90 << (
iv.low % 60 < 10 ?
"0" :
"") <<
iv.low % 60
91 <<
" - " <<
iv.high / 60 <<
":"
92 << (
iv.high % 60 < 10 ?
"0" :
"") <<
iv.high % 60
100 cout <<
"\n=== 1D Segment Intersection ===" <<
endl;
121 cout <<
"Segments:" <<
endl;
122 for (
const auto & s : segments)
124 <<
" x=[" << s.x_range.low <<
", " << s.x_range.high <<
"]"
130 for (
const auto & seg : segments)
133 if (
not overlaps.is_empty())
135 cout <<
"\nSegment y=" << seg.y
136 <<
" x=[" << seg.x_range.low <<
"," << seg.x_range.high
137 <<
"] shares x-range with:" <<
endl;
139 cout <<
" x=[" <<
iv.low <<
", " <<
iv.high <<
"]" <<
endl;
145 cout <<
"\nTree verified: " << (active.
verify() ?
"yes" :
"no") <<
endl;
High-level interval tree with automatic memory management.
DynList< Key > find_all_overlaps(const Key &query) const
Find all overlapping intervals.
Key & insert_dup(const Key &iv)
Insert interval, allowing duplicates.
Key & insert(const Key &iv)
Insert an interval (unique).
bool verify() const
Verify all tree invariants (BST, Treap, MaxEndpoint).
Represents a line segment between two points.
void segment_intersection()
Scenario 2: 1D segment intersection.
void meeting_scheduler()
Scenario 1: Meeting scheduler — detect conflicts.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
Closed interval [low, high].
Interval tree: augmented BST for overlap/stabbing queries.