Which is better approach to implement Viterbi algorithm in c? [closed] - c

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
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.
I am a newbie in C and would appreciate any help regarding which method would be better with the specific reasons.

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).

Related

Historically, why asterisk for a pointer/indirection in C? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last month.
Improve this question
One of my students asked why C would use * for pointers since it's already the multiplication operator. I didn't have a good response. I looked into some of the history, but couldn't find a "why". Hoping some of you might have been around a bit longer than me and know why * for pointer/dereferencing/indirection.
I understand this is not necessarily a coding-question per say, so some might get upset it is posted on Stack Overflow, but I know of no better place to ask this question.

graph traversal in C [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have to implement a backtracing algorithm in C which will emulate a hardware in purely software, and trace a single path from output of a system to the input pin, registering all the gates, their outputs and inputs(taken) on the path in a reverse order. I figured out that it can be done in graph traversal algorithm but not able to implement in C. Any useful suggestions shall be helpful indeed!
I've done a few maze solving algorithms, both breadth and depth first search.
I'd say you should first build a graph and make sure its perfectly built and without any incoherence, and something i found to be very useful was to find a way to print my graph to check for errors :).
Other than that, good luck !
Depends on what kind of path tracing, it can follow both breadth first search or else Depth first search. I have tried both of them and it works.

Can any program of C be written in R programming language? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I want to know whether any program which is written using C programming language can be written using R programming language or not. I know that it is possible to call C code from R, but I want to know if I want to write every algorithm in R from scratch whether it is possible or not.
I want to know does R has all constructs required to implement all programs written in C lanuage?
Yes, both are Turing complete.

What are the pros and cons for opaque pointers vs id numbers using the C programming language? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm currently using opaque pointers as my standard technique for encapsulation, but looking at the OpenGL API makes me think that using id numbers could be a better choice. I would like some advice from seasoned C programmers (I've only been using the language actively for ~2 years).
Here are my initial thoughts that I would like confirmed or corrected.
Possible pros for Id numbers:
Using object/memory pools in the implementation is rather straight forward if using id numbers
The id number does not have to map to the system memory (could reference graphics memory in the GL case)
Possible cons for Id numbers:
Makes the implementation slightly more complex
There is a similar question that takes into account the situation of using shared libraries:
Should I use integer ID or pointers for my opaque objects?
My question is not about shared libraries, it's about the general case of hiding implementation details from user code.
I suppose you could typedef a MyObjectHandle to enable the library to switch between id number and opaque pointer.
The question is:
What are the pros and cons for opaque pointers vs id numbers using the C programming language?

Nested for-loop that is only O(n) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How would I write a function that contains a nested for-loop but is only order(n)? Im not sure if i need to use recursion or not.
If the inner for loop is a constant number of loops rather than a variable number of loops, while the outer loop is a variable number of loops (or vice versa) the time complexity is O(n*C) where C is a constant, which just means O(n) (since big O notation is only concerned with growing factors).

Resources