I want to implement the Viterbi algorithm for decoding convolutional codes.
我想实现维特比算法来解码卷积码。
Would it be better to implement it using 2D arrays or using linked lists in C programming language.
使用2D数组或使用C编程语言中的链表实现它会更好吗?
I am a newbie in C and would appreciate any help regarding which method would be better with the specific reasons.
我是C的新手,并希望了解哪种方法更好,具体原因。
1 个解决方案
#1
1
It's be better to implement it using 2D array since you have to access random index with a constant time complexity of O(1). You can't access random index in linked lists with a constant time complexity of O(1).
最好使用2D数组实现它,因为您必须以恒定的时间复杂度O(1)访问随机索引。您不能以恒定的时间复杂度O(1)访问链表中的随机索引。
#1
1
It's be better to implement it using 2D array since you have to access random index with a constant time complexity of O(1). You can't access random index in linked lists with a constant time complexity of O(1).
最好使用2D数组实现它,因为您必须以恒定的时间复杂度O(1)访问随机索引。您不能以恒定的时间复杂度O(1)访问链表中的随机索引。