computer-science

What does “level of indirection” mean in David Wheeler's aphorism?

邮差的信 提交于 2019-11-28 16:30:51
问题 I've read this quote in a book: There is no problem in computer science that can't be solved using another level of indirection. Can someone explain that? What does "level of indirection" mean? From what I understood, indirection is a fancy name for using a pointer of a value instead of the value itself. Please clarify this for me. 回答1: "Indirection" is using something that uses something else, in its broadest sense. So your example, using a pointer of a value instead of the value, fits this

How do I implement graphs and graph algorithms in a functional programming language?

我是研究僧i 提交于 2019-11-28 15:17:12
问题 Basically, I know how to create graph data structures and use Dijkstra's algorithm in programming languages where side effects are allowed. Typically, graph algorithms use a structure to mark certain nodes as 'visited', but this has side effects, which I'm trying to avoid. I can think of one way to implement this in a functional language, but it basically requires passing around large amounts of state to different functions, and I'm wondering if there is a more space-efficient solution. 回答1:

When to use Preorder, Postorder, and Inorder Binary Search Tree Traversal strategies

柔情痞子 提交于 2019-11-28 15:01:52
I realized recently that while having used BST's plenty in my life, I've never even contemplated using anything but Inorder traversal (while I am aware of and know how easy it is to adapt a program to use pre/post-order traversal). Upon realizing this, I pulled out some of my old data-structures textbooks and looked for reasoning behind the usefulness of pre-order and post-order traversals - they didn't say much though. What are some examples of when to use preorder/postorder practically? When does it make more sense than in-order? Eric Leschinski When to use Pre-Order, In-Order, and Post

What is code coverage and how do YOU measure it?

空扰寡人 提交于 2019-11-28 14:56:37
What is code coverage and how do YOU measure it? I was asked this question regarding our automating testing code coverage. It seems to be that, outside of automated tools, it is more art than science. Are there any real-world examples of how to use code coverage? Franci Penov Code coverage is a measurement of how many lines/blocks/arcs of your code are executed while the automated tests are running. Code coverage is collected by using a specialized tool to instrument the binaries to add tracing calls and run a full set of automated tests against the instrumented product. A good tool will give

Understanding Neural Network Backpropagation

我与影子孤独终老i 提交于 2019-11-28 14:36:27
问题 Update: a better formulation of the issue. I'm trying to understand the backpropagation algorithm with an XOR neural network as an example. For this case there are 2 input neurons + 1 bias, 2 neurons in the hidden layer + 1 bias, and 1 output neuron. A B A XOR B 1 1 -1 1 -1 1 -1 1 1 -1 -1 -1 (source: wikimedia.org) I'm using stochastic backpropagation. After reading a bit more I have found out that the error of the output unit is propagated to the hidden layers... initially this was confusing

Fixed point vs Floating point number

假如想象 提交于 2019-11-28 13:25:02
问题 I just can't understand fixed point and floating point numbers due to hard to read definitions about them all over Google. But none that I have read provide a simple enough explanation of what they really are. Can I get a plain definition with example? 回答1: A fixed point number has a specific number of bits (or digits) reserved for the integer part (the part to the left of the decimal point) and a specific number of bits reserved for the fractional part (the part to the right of the decimal

Find k rectangles so that they cover the maximum number of points

耗尽温柔 提交于 2019-11-28 11:50:33
In two dimensional space, given a bunch of rectangles, every rectangle covers a number of points and there may be overlap between two arbitrary rectangles, for a specified number K, how can i find the k rectangles such that their union cover the maximum number of points? In this problem, if a point is covered by more than two rectangles it is only counted once and we assume that the positions & size of rectangles and positions of points are fixed as given in the input. Can someone give me the algorithm used to solve it? Or point out that it can be reduced to some known problem? This looks like

What was the Historical Precursor for .NET Attributes?

扶醉桌前 提交于 2019-11-28 11:30:21
What languages or platforms influenced the .NET 1.0 Team to build-in the concept of Attributes from the very start? Was this an Aspect-Oriented thing? Serialization? or something else? I was still in VB6-land at this time, and never used any of the pre-1.0 .NET versions. Believe it or not experiences/feedback from VB and Microsoft Transaction Server/COM+ dev teams had a bit part in some of the design rational of .NET, attributes and metadata. VB6 added support for attributes/metadata that COM+/MTS could read and determine how an object should behave. Remember all those settings on your classes

How do I generate sentences from a formal grammar?

混江龙づ霸主 提交于 2019-11-28 06:56:01
What's a common way of generating sentences from a grammar? I want an algorithm that's sort of the opposite of a parser. That is, given a formal context-free grammar (say LL), I want to generate an arbitrary sentence that conforms to that grammar. I use sentence here to mean any valid body of text, so it can actually be a whole program (even if it doesn't make any sense—as long as it's syntactially correct). Example grammar: program : <imports> NEWLINE? <namespace> imports : ("import" <identifier> NEWLINE)* namespace : "namespace " <identifier> NEWLINE "{" <classes> "}" identifier: (A-Za-z_)

Level of Indirection solves every Problem

徘徊边缘 提交于 2019-11-28 05:17:15
What does the quote "Level of Indirection solves every Problem" mean in Computer Science? Generally it means that by increasing the level of abstraction one can make the problem easier to understand/resolve. Be careful with your abstractions though, the full quote at least as I heard it is, "You can solve every problem with another level of indirection, except for the problem of too many levels of indirection". From the book Beautiful Code : All problems in computer science can be solved by another level of indirection," is a famous quote attributed to Butler Lampson, the scientist who in 1972