What is the advantage of maintaining four indexes in the diff algorithm of virtual dom?

The diff algorithm of almost all virtual dom on the

network maintains four index variables to make dom changes. Excuse me, what is the advantage of this kind of algorithm, and why do all choose this kind of algorithm?

what are the disadvantages if I use a simple loop operation algorithm (such as below)?

iterate through the nodes of the newVdom one by one to find its location in the oldVdom, move the corresponding DOM element if it is found, and create a new node to insert if it does not show that it is a new node. If there are any unprocessed nodes in the oldVdom after traversal, these nodes have been deleted in the newVdom, and you can delete them.

Mar.21,2021
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-1b3b9fc-2c293.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-1b3b9fc-2c293.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?