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.
Related
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 3 years ago.
Improve this question
I understand that an algorithm is a set of instructions. Ai is essentially the same thing, only, more complicated? Let's say I use a minmax algorithm to allow moves to be played on a tic tac toe board, generally people would consider this ai. But if I implement an algorithm to solve a rubiks cube, is that considered ai?
I guess what I'm asking is, is it the complexity of the algorithm, the fact that situations change on the fly in an algorithm, the ignorance of the user/programmer as to how the algorithm works or all/some of the above? Or am I missing something?
I feel like this field is quite arbitrary. I imagine for good reason.I imagine because complexity is complex.
It is indeed quite arbitrary.
If you consult wikipedia you might find following definition which in my personal opinion catches the load quite accurately:
Computer science defines AI research as the study of "intelligent
agents": any device that perceives its environment and takes actions
that maximize its chance of successfully achieving its goals. A more
elaborate definition characterizes AI as "a system's ability to
correctly interpret external data, to learn from such data, and to use
those learnings to achieve specific goals and tasks through flexible
adaptation."
To take your Rubiks Cube as an example, there would be at least 2 ways you could write the algoritm to solve the puzzle. Firstly, any cube can be solved by following a hardcoded path or set of instructions once you have a certain start position. Implementing this would not be considered AI in my opinion as the machine itself is not learning anything. It just follows a well defined path of instructions till the end.
A second way to implement this would be to have the program just start solving it randomly. But the machine remembers it's moves, and learns the most effective path to reach the solution. When solving the next cube, the machine can build upon this newly learned information to solve it faster and again learn from this iteration to improve it's algorithm.
So in short, as far as I'm concerned, it can be considered AI when a machine is capable of optimizing/extending its own algorithms to become more efficient in its tasks.
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).
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 5 years ago.
Improve this question
I'm building a two-pass assembler in C.
A part of its job is to be able to work on matrices.
Let's say that there is the following line:
mov m[r2][r5], XYZ
mov is the operation.
and m[r2][r5] and XYZ are the operands.
I need to find out if an operand is a matrix. and get the:
1. matrix name.
2. row.
3. column.
How is it possible?
Tried to use sscanf without any success.
Thanks in advance!
Unfortunately writing an assembler is not as easy as using the scanf. Simplifying: You need to divide the input stream into the tokens, then you need to parse it and build the semantic tree, then you need to do the semantic analysis, reduce the tree (by evaluating constant expressions, finding addresses etc etc), and eventually generate the machine code.
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 8 years ago.
Improve this question
http://www.tech.dmu.ac.uk/~eg/tensiometer/fft/fft.c
http://www.tech.dmu.ac.uk/~eg/tensiometer/fft/fft_test.c
I have found a good working C Code for FFT Algorithm for converting Time Domain to Frequency Domain and vice versa in the above links. But I wanted to know the flowchart or step by step process of how this code works. I am trying to analyze the code with butterfly method of decimation in time for FFT but i am facing difficulties in understanding the code. The code is working very well and giving me the correct results but it would be very helpful to me if someone could give a brief or detailed explaination on how this code works.
I am confused with the array and the pointers used in the fft.c code. Also I am not getting what are the variables offset and delta mean in the code. How the rectangular matrix of real and imaginary terms are considered/used in the code?? Please guide me.
Thanks,
Psbk
I strongly recommend to read this: https://stackoverflow.com/a/26355569/2521214
Now from the first look the offset and delta is used to:
make the butterfly shuffle permutation
you start with step 1 and half of the interval
and by recursion you will get to log2(N) step and interval of 1 item ...
+/- one recursion level
I usually do the butterfly in reverse order
The XX array
is a buffer to store the subresult or input data
you can not perform FFT inplace easily (if at all)
so you compute to/from the temp buffer instead
and on each recursion just swap the data and temp buffers (physically or their meaning)
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 8 years ago.
Improve this question
I have a question. I hope everybody help me.
I'm learning Data Structures in C. I have a homework but I can't find a solution to solve it.My teacher wants me write 11 sorts.
In singly linked list i has installed 6 sorts:Interchange Sort, Bubble Sort, Selection Sort, Quick Sort, Merge Sort and Radix Sort.
So i need everybody help me write 5 sorts: Insertion Sort, Binary Insertion Sort, Shaker Sort, Heap Sort, Shell Sort. If it can't use in singly linked list,can you tell me why it can't use?
I really need your help. Please answer to help me.Thank you very very very much!!!!!
http://en.wikipedia.org/wiki/Sorting_algorithm
This will give you various sorting algorithms, and when you select most of the algorithms wikipedia will have some pseudo code for that algorithm. It's a really good exercise to translate pseudo code into the native language that you're writing it in (in this case C); I still do it when I'm learning a new language since implementing sorting algorithms usually gives you a good handle on the basics of that language.
From a more mothering/lecturing point, you won't have an easier time in your later classes if all you end up doing is getting your code from other people, you need to solve it yourself, plain and simple.
From the list of one's you have done quick and merge sort are probably the hardest, if you have those written (and actually wrote them) the rest should be fairly easy.