The time complexity of the traditional diff algorithm mentioned in React is O (n ^ 3)?

The time complexity of the traditional diff algorithm mentioned in

React is O (n ^ 3)?
how does this calculate the amount?

Jul.20,2021

A survey on tree edit distance and related problems

the way React uses is theoretically O (n), because of some restrictions and auxiliary (key).

related: https://reactjs.org/docs/reco.


react trees are compared according to levels. He will give the tree the number 0meme1pl 2p3pl 4. Then compare with the same number. So the complexity is n, which is easy to understand.

the key is how to calculate the complexity of traditional diff? Traditional diff requires cross-level comparisons in addition to the above comparisons. He will compare the
nodes of two numbers, which is the complexity of n ^ 2. Then you need to edit the tree, which can occur at any node, and you need to traverse the tree again, so the complexity is n. It adds up to n ^ 3. I am not involved in the rigorous reasoning process here, just to give you a perceptual understanding. If there are any mistakes, we will not be held responsible.

here is an answer. You can also refer to react

.
how do you calculate O (n ^ 3) and O (n) from O (n ^ 3) to O (n),? -COIN's answer-Zhihu
https://www.zhihu.com/questio..
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34ad7-e481.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34ad7-e481.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?