Why binary and not ternary computing? [closed]

It is much harder to build components that use more than two states/levels/whatever. For example, the transistors used in logic are either closed and don’t conduct at all, or wide open. Having them half open would require much more precision and use extra power. Nevertheless, sometimes more states are used for packing more data, but … Read more

Calculate minimal operations to make two tree structures identical

There is not only a Wikipedia article on graph isomorphism (as Space_C0wb0y points out) but also a dedicated article on the graph isomorphism problem. It has a section Solved special cases for which polynomial-time solutions are known. Trees is one of them and it cites the following two references: P.J. Kelly, “A congruence theorem for … Read more

What Computer Science concepts should I know? [closed]

Take a look at this blog post by Steve Yegge (formerly of Amazon, now at Google): The Five Essential Phone Screen Questions It goes into some detail about the the five most important concepts that developers should be required to know: Basic programming (including recursion, file I/O, formatted output, loops etc) Object oriented design (including … Read more

What is recursion and when should I use it?

There are a number of good explanations of recursion in this thread, this answer is about why you shouldn’t use it in most languages.* In the majority of major imperative language implementations (i.e. every major implementation of C, C++, Basic, Python, Ruby,Java, and C#) iteration is vastly preferable to recursion. To see why, walk through … Read more

Hash Code and Checksum – what’s the difference?

I would say that a checksum is necessarily a hashcode. However, not all hashcodes make good checksums. A checksum has a special purpose — it verifies or checks the integrity of data (some can go beyond that by allowing for error-correction). “Good” checksums are easy to compute, and can detect many types of data corruptions … Read more

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

When to use Pre-Order, In-Order, and Post-Order Traversal Strategy Before you can understand under what circumstances to use pre-order, in-order and post-order for a binary tree, you have to understand exactly how each traversal strategy works. Use the following tree as an example. The root of the tree is 7, the left most node is … Read more