我有一個鏈接列表,其中添加一個對象就像一棵樹,下面是打印輸出 LinkedList nodeList = new LinkedList();顛倒鏈接列表的順序
(結果A)
1 : Tester Meeting
2 : Adminstrative & Operational
3 : Functional Committees
4 : Aduit Committee
9 : Supporting Services Development
8 : Medical Services Development
7 : Information Technology Services
6 : Human Resources Committee
15 : test2-2
14 : test2
13 : test1-1
12 : test1
5 : Finance Committee
10 : Regional Advisory Committees
11 : Board Workshop
(結果B)下面列出的是正確的順序
Tester Meeting
Adminstrative & Operational
Functional Committees
Aduit Committee
Finance Committee
test1
test1-1
test2
test2-2
Human Resources Committee
Information Technology Services
Medical Services Development
Supporting Services Development
Regional Advisory Committees
Board Workshop
所以,我要扭轉的審計委員會的子節點的順序( ResultA)輸出與ResultB相同的結果,是否有任何方法來排序鏈表的特定節點?
LinkedList不是的一棵樹,所以 '子節點' 是如何實現的? –
這不是排序樹的問題,而是你如何走樹。 –
LinkedList排序不好,任何你不使用List <>的原因? –