An alternative method for tree comparison

Source: Internet
Author: User

Comparing two regions is often one of the functions that need to be implemented in information systems, such as comparing different organizational structures and comparing different product BOM structures, we usually use the tree data structure for comparison, such as traversal and iteration. This article presents an alternative comparison method for your reference.
In a system I am working on, we also need to implement tree comparison, which is described as follows:

People who have a certain impression on the product structure may know that the structure of parts in a product is often very complex, not only a large number of parts, but also a deep hierarchy, think about the structure of a car. If we want to compare the two Bom, we will use the traditional tree comparison method to traverse and iterate
Efficiency is very low.
By chance, I saw a file comparison in codeproject.ArticleIs it more efficient to export the BOM structure as a file and compare the file? The sequence diagram of the example is shown in:

The main idea is to export the BOM tree as a text file. The fileengine class is the engine class for exporting the BOM and the engine class for file comparison, htmlengine class is an engine class that generates comparison results into HTML files. The reason why HTML files are used to store comparison results is that HTML is relatively easy to generate and can be conveniently viewed, if you use a copy screen or other format file, you must use different colors to identify the differences.
At present, it has been implemented. What is lacking in the United States is that the efficiency of file comparison needs to be further improved. If you have any suggestions, please let me know.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.