6
Q
跳過列表的合併
A
回答
7
store the two skip lists in two arrays: A,B
merge the arrays.
repeat until getting into root ('top' is a linked list containing only one element):
for each second entry in the skip list 'top' add a 'tag' (link 'upstairs' of the previous level)
它確實是爲O(n),因爲存儲和合並是O(N),並在循環中,你需要遍歷:
n+n/2+n/4+n/8+... = sigma(n/2^k) where k in (0,infinity) = 2n
相關問題
- 1. Git合併跳過提交
- 2. 合併PDFs跳過損壞的PDF
- 3. 跳過列範圍的第一個值並添加到列表
- 4. git - 合併時跳過特定提交
- 5. JGIT - 在日誌中跳過合併
- 6. jquery跳過列表項
- 7. 使列表跳過圖像
- 8. 插入跳過列表
- 9. 跳過列表comprehnsion 2行
- 10. 在跳過數值的同時跳過python中的列表
- 11. 合併列表
- 12. 合併列表
- 13. 通過顛倒列表查找兩個列表的合併點
- 14. 跳過並採取列表中的方法
- 15. 用os.walk跳過列表中的目錄?
- 16. 如何跳過列表中的值?
- 17. Java上的跳過列表擴展AbstractMap
- 18. 合併列表python
- 19. 合併含列表
- 20. Python列表的列表合併
- 21. 合併列表和「合併」排序
- 22. 合併與列表理解Zip合併
- 23. 的Python:取兩個列表,並通過將它們合併
- 24. 的Python:合併列表
- 25. 合併兩個列表的
- 26. 合併數據表的列
- 27. 合併排序的列表
- 28. 元組的合併列表
- 29. 的Python:合併列表
- 30. 是否可以迭代列表並跳過某些元素?
我不知道我用了skip-正確列出條款(在循環中)但我確信這個解決方案是正確的。讓我知道如果你不明白的東西。 – amit 2011-05-08 08:36:15