Structures for efficient indexing of objects at intervals

I am currently playing with some ideas on CRF-ish, and I have an idea that I need help.

Minimal problem

I have a bunch of functional objects (I think something is expensive, like neural networks). They apply to a linear buffer (I think, an array from floator bytes), but with variable intervals. So they look like this (think of the beginning and the end as “apply Object to buf[Start:End]”:

| Object | Start | End |
|--------|-------|-----|
| A      | 0     | 4   |
| B      | 4     | 10  |
| C      | 13    | 15  |

Interval Characteristics

  • There may be some omissions (e.g. see start C against end B)
  • There will definitely be changes in the intervals, both positive and negative (for example, B may change from [4:10]to [4:12].
  • , (), , , .
  • , . , B [4:10] [3:12], A [0:3], B [3:12]
  • , . , , B, C 2, C.

  • ( ).
  • : insert, delete, shiftleft, shiftright. , insert/delete, .
  • ( ) .
  • .
  • , , Go, + goroutine ( , ).
  • 5 60 .
  • , .

Task

:

  • : ,
  • : ( ).
  • :

- , , ?

- ?

, . , / . - .

, , .

+4
1

, , .

  • funcs -, .

  • ints s, , ; " " . -1 , - .

  • (int, int) intervals, intervals[i] , funcs[i].

, . , i s[i], funcs[s[i]] intervals[s[i]]. , s, s intervals, , . , . ( , ? , ? " , .)

+1

Source: https://habr.com/ru/post/1687976/


All Articles