implementation

Powerful algorithms too complex to implement [closed]

天大地大妈咪最大 提交于 2019-12-03 12:21:48
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . What are some algorithms of legitimate utility that are simply too complex to implement? Let me be clear: I'm not looking for algorithms like the current asymptotic optimal matrix multiplication algorithm, which

counting boolean parenthesizations implementation

♀尐吖头ヾ 提交于 2019-12-03 09:32:11
问题 Given a boolean expression containing the symbols {true, false, and, or, xor}, count the number of ways to parenthesize the expression such that it evaluates to true. For example, there is only 1 way to parenthesize 'true and false xor true' such that it evaluates to true. Here is my algorithm we can calculate the total number of parenthesization of a string Definition: N - the total number of True - the number of parenthesizations that evaluates to true False - the number of

C++ header and implementation files: what to include?

浪子不回头ぞ 提交于 2019-12-03 09:32:10
There is a .h file and a .cpp file with the same name but different extension. If I want to use what's in the .cpp file, do I include the .h file or the .cpp file? The simple answer is that you almost always want to include .h files, and compile .cpp files. CPP files are (usually) the true code, and H files are (usually) forward-declarations. The longer answer is that you may be able to include either, and it might work for you, but both will give slightly different results. What "include" does is basically copy/paste the file in at that line. It doesn't matter what the extension is, it will

Binary serialization in pure C/C++

夙愿已清 提交于 2019-12-03 09:02:51
I'd like to implement the binary serialization on my own, without using Boost or any other third-party library. In C++ the simpliest way to achieve it is to use ofstream and then send a binary file over network. But is there any other stream class which I can use as a temporary buffer to avoid writing file to disk? Also, how can I achieve that in pure C? Persistence is hard issue. It is not trivial to even serialize an object to disk. Say that, for example, you have a structure like this one in C: struct Person { char name[100]; int year; }; This is a sef-contained structure, probably the

How might I index PDF files using Lucene.Net?

心已入冬 提交于 2019-12-03 08:51:14
问题 I'm looking for some sample code demonstrating how to index PDF documents using Lucene.Net and C#. Google turned up a few, but none that I could find helpful. 回答1: From my understanding, Lucene is limited to creating an index and searching that index. It's up to the application to handle opening files and extracting their contents for the index. So if you're looking to search PDF documents you'll want to use something like iTextSharp to open the file, pull out the contents, and pass it to

Why heap is better than binary tree to represent a priority queue?

大兔子大兔子 提交于 2019-12-03 07:09:30
In a (max) heap it is easy to find the biggest item in O(1) time, but to actually remove it you need complexity of O(log(n)) . So if the insertion and deletion from a heap is both O(log(n)) , what are the advantages of a heap over binary tree for representing a priority queue? Heaps use less memory. They can be implemented as arrays and thus there is no overhead for storing pointers. (A binary tree CAN be implemented as an array, but there is likely to be many empty "gaps" which could waste even more space than implementing them as nodes with pointers). Heaps are guaranteed to have height of

how does Cpython implement its type Objects, i.e. type's type is always type?

跟風遠走 提交于 2019-12-03 04:58:06
I understand that everything in python is an Object and that the 'type' (or class) of these object is 'type'. Plus the type of type is also type itself. (as explained nicely here ) What I do not understand is how is this circular reference implemented? So i looked here . To quote the portion which might explain what I am looking for: PyTypeObject* PyObject.ob_type This is the type’s type, in other words its metatype. It is initialized by the argument to the PyObject_HEAD_INIT macro, and its value should normally be &PyType_Type. However, for dynamically loadable extension modules that must be

Powerful algorithms too complex to implement [closed]

我的未来我决定 提交于 2019-12-03 02:48:43
What are some algorithms of legitimate utility that are simply too complex to implement? Let me be clear: I'm not looking for algorithms like the current asymptotic optimal matrix multiplication algorithm, which is reasonable to implement but has a constant that makes it useless in practice. I'm looking for algorithms that could plausibly have practical value, but are so difficult to code that they have never been implemented, only implemented in extremely artificial settings, or only implemented for remarkably special-purpose applications. Also welcome are near-impossible-to-implement

How might I index PDF files using Lucene.Net?

和自甴很熟 提交于 2019-12-02 21:27:27
I'm looking for some sample code demonstrating how to index PDF documents using Lucene.Net and C#. Google turned up a few, but none that I could find helpful. From my understanding, Lucene is limited to creating an index and searching that index. It's up to the application to handle opening files and extracting their contents for the index. So if you're looking to search PDF documents you'll want to use something like iTextSharp to open the file, pull out the contents, and pass it to Lucene for indexing. There are some good starting examples of using Lucene on the Dimecasts.net website.

How to implement an artificial neural network in Delphi? [closed]

心不动则不痛 提交于 2019-12-02 21:25:51
I want to have an artificial neural network: 42 input neurons 168 hidden neurons 7 output neurons This network is to play the game of "Connect Four". At the end of each game, the network gets feedback (game result / win?). Learning should be done with Temporal Difference Learning. My questions: What values should be in my reward array? And finally: How can I apply it to my game now? Thank you so much in advance! First hit is: you're assigning '0' to t in 'main', but your arrays' low-bound is '1', so you're accessing a non-existing element in the loops, hence the AV. If you had enabled range