Speed ​​up to adjacency matrix

I currently have an algorithm that works on an adjacency matrix of size n by m. In my algorithm, I need to zero out whole rows or columns at a time. My implementation is currently O (m) or O (n), depending on whether it is a column or a row.

Is there a way to nullify a column or row in O (1) time?

+3
source share
3 answers

Essentially, it depends on the Chip architecture you are dealing with. For most processors, it is impossible to disable entire areas of memory, and therefore each word will require a separate memory operation, regardless of what tools your programming language provides.

, , , , , , .

, , , , , .

: , , , , " ". , - , - ( nxm), . nxm- , .

+3

? ( ). . , 0 ( , ). , .

0

, .

, , , , . , O (N) .

- , - . O (1), ; node , . , (, , , /w631 > ).

0

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


All Articles