VB Redim Preserve 對 Linked List

2007-03-09 8:02 pm
如題,既然VB有ReDim Preserve作為對動態Array的修改,咁Linked List是否無用?
以往學C / Java時,就有教Data Structure and Algorithm,但係用VB時,是否可以用dynamic array 代取 Linked List 的寫法?

回答 (1)

2007-03-09 8:11 pm
✔ 最佳答案
A dynamic array allows you to size up or down an array, but does not allow an element to be inserted or deleted as linked lists can do.
To insert an element and keep an array sorted, you would need to move the rest of the elements before insertion.
On the other hand, it is not easy to do a binary search on a linked list.
Also, if the elements are static, i.e. no interactive additions or deletions, an array may do a good job.
So, which choice is better is really up to you, which in turn depends on your application.


收錄日期: 2021-04-12 20:08:46
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070309000051KK00940

檢視 Wayback Machine 備份