Looking for an implemenentation of binomial tree in c++ - c++

If anyone can point me into direction where i can find an easy to understand impl. of binomial tree, that would be very helpful. thx
tree should look like in this article: http://software.intel.com/en-us/articles/high-performance-computing-with-binomial-option-pricing-part-1/

I have used this example in the past to develop a project that required us to use a binomial tree model, however, this example is in C#.
http://www.codeproject.com/KB/recipes/binomialtree.aspx

Related

What algorithm opencv GCGRAPH (max flow) is based on?

opencv has an implementation of max-flow algorithm (class GCGRAPH in file gcgraph.hpp). It's available here.
Does anyone know which particular max-flow algorithm is implemented by this class?
I am not 100% confident about this, but I believe that the algorithm is based on this research paper describing max-flow algorithms for computer vision. Specifically, Section 3 describes a new algorithm for computing maximum flows.
I haven't lined up every detail of the paper's algorithm with the implementation of the algorithm, but many details seem to match:
The algorithm described works by using a bidirectional search from both s and t, which the implementation is doing as well: for example, there's a comment reading // grow S & T search trees, find an edge connecting them.
The algorithm described keeps track of a set of orphaned nodes, which the variable std::vector<Vtx*> orphans seems to track in the implementation.
The algorithm described works by building up a set of trees and reusing them; the algorithm implementation keeps track of a tree associated with each node.
I hope this helps!

Data structures implementation code understanding

Im taking a course in algorithms and data structers, and my instructor wants me to implement several data structers (such as BST, stack etc.), and algorithms (such as quick search, DFS, etc.).
I want to belive that I understand the basics, but everytime Im starting to plan the code I have the same difficulty:
here's my current assigment: my instructor wants me to implement a DFS (depth first search) for a directed graph (using c++).
my question is- how do I suppose to implement the graph? should I use adjacency matrix? or should I use adjacency list? neither this nor that??
so I asked my instructor, and his answare was this: "think of the graph as a black box"...
more confused than before, I rashed to stackoverflow, and here i am posting this question...
I dont look for someone to tell me how to implement DFS (or any other algorithm- I can google too!)- I just need someone to explain what should I get as input, and what should I provide as output?
I'll appreciate any comment! thanks!
What he means by a black box is just that you cannot see the nodes and how they connect before you do your DFS. You will probably just get the root node and your algorithm with have to explore from there. As for what you should output- that depends on the assignment. Are you looking for specific data? if not, perhaps a detail of which nodes were visited in which order.

How to implement 3d kDTree build and search algorithm in c or c++?

How to implement 3d kDTree build and search algorithm in c or c++? I am wondering if we have a working code to follow
I'd like to recommend you a two good presentations to start with:
"Introduction to k-d trees"
"Lecture 6: Kd-trees and range trees".
Both give all (basic ideas behind kd-trees, short visual examples and code snippets) you need to start writing your own implementation.
Update-19-10-2021: Resources are now longer public. Thanks to #Hari for posting new links down below in the comments.
I found the publications of Vlastimil Havran very useful. His Ph.d Thesis gives a nice introduction to kd-trees and traversal algorithms. Further articles are about several improvements, e.g. how to construct kd-tree in O(nlogn). There are also a lot of implementations in different graphic libs. You should just google for it.
For an example of a 3D kd-tree implementation in C, take a look at kd3. It is not general purpose library and requires the input data to be in a specific form, but the ideas and approach should be transferable.
Disclosure: I am the author of kd3.
Disclaimer: It was written as proof-of-concept code for an existing application and is therefore not as generic nor as well-tested as it should be. Bug reports/fixes are welcome.

Application of List Ranking algorithm

I've been reading about List Ranking Algorithm from many sources like
http://www.cs.cmu.edu/~scandal/alg/listrank.html
I found that it is useful in Parallel Tree Contraction,Euler tour of tree etc.but i'm not getting actual use of this list algorithm in above applications.Does anyone have any idea of how List ranking is useful in these or any algorithms?
The first thing I can imagine is that you can easily compute the height of all nodes in a tree. It's not exactly an algorithm, but can be pretty useful in some cases.

c++ petsc matrix inversion

can any one share with me a few different example of dense matrix inversion's with Petsc. I searched the web and could only find algorithm's and no solid examples with code. Thank you
In their documentation. They seems to say which function to call when.
You can find it here.
Also, I found a manual that provides multiples code example that you might want to look at.
Hope it helps!