Write a program in C language: merge two sequence tables and equal elements of the two sequence tables, and construct a new sequence table from the equal elements...

You can use two pointers to point to the two sequence tables respectively, compare the size of the elements currently pointed to by the two sequence tables, add the smaller element to the new sequence table, and then move the pointer back until the two pointers reach the end of the two sequence tables. If two elements are equal, add them to the new sequence table and move both pointers back one bit. Finally, the new sequence table is a new sequence table constructed by merging the two sequence tables and equal elements.

Guess you like

Origin blog.csdn.net/weixin_42607969/article/details/129576908