阅读背景:

Sorting Linked Lists - move nodes or swap data members?

来源:互联网 

I have a simple question. I'm working on a C++ app that is a contact list app. It stores names, addresses, numbers, ages, etc for multiple people. I'm using stucts and linked lists (nodes). I'm building the sort list function, to alphabetize the list. I'm currently wondering if it's better to actually reorder the list by moving the structs as a whole or by swapping the data members inside each node. At first, I considered moving the nodes, but now swapping the data members seems more safe, as I don't have to reorder the list. At any rate, I don't know if either possesses any benefits over the other.I have a simple question. I'm working on a C++




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: