Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

Add Intervals Algorithm: Insert Intervals.

Open Aryaman3007 opened this issue 2 years ago • 4 comments

I want to add the Insert Intervals algorithm in C++.

Insert Intervals

The insert intervals algorithm will find the correct position to insert the new interval while ensuring that the resulting intervals are still in ascending order and non-overlapping. If the new interval overlaps with existing intervals, it should be merged with the overlapping intervals.

For example, given the input intervals: [[1,3], [6,9], [10,13]], and the new interval to insert: [7,12], the output should be: [[1,3], [6,13]].

I Will provide the approach and solution for Merge Intervals and Insert Intervals algorithms with proper comments and documentation.

I would like to work on this issue. Could you please assign this issue to me under SSoC ' 23.

Aryaman3007 avatar May 31 '23 03:05 Aryaman3007

What exactly is the name of this algorithm and under what category does your implementation fall under (ex: sorting, searching, greedy method, dynamic programming, etc)

Kumar-laxmi avatar May 31 '23 04:05 Kumar-laxmi

It is a greedy algorithm and I would like to add only the Insert Interval question as the merge interval is already added.

Aryaman3007 avatar May 31 '23 05:05 Aryaman3007

Assigned! @Aryaman3007 : C, C++, Java and Python

Kumar-laxmi avatar May 31 '23 05:05 Kumar-laxmi

Could you please add this issue on quine.

Aryaman3007 avatar Jun 01 '23 13:06 Aryaman3007

This issue has been automatically closed because it has been inactive for many days. Please reopen if you still intend on working on this problem

github-actions[bot] avatar Aug 13 '24 16:08 github-actions[bot]