Difference between binary tree and binary search tree
Can anyone please explain the difference between binary tree and binary search tree with an example? 12 Answers 12
Can anyone please explain the difference between binary tree and binary search tree with an example? 12 Answers 12
This is a simple question from algorithms theory. The difference between them is that in one case you count number of nodes and in other number of edges on the shortest path between root and concrete node. Which is which? 11 Answers 11
Does anyone know how the built in dictionary type for python is implemented? My understanding is that it is some sort of hash table, but I haven’t been able to find any sort of definitive answer. 3 Answers 3
A long time ago, I bought a data structures book off the bargain table for $1.25. In it, the explanation for a hashing function said that it should ultimately mod by a prime number because of “the nature of math”. What do you expect from a $1.25 book? Anyway, I’ve had years to think about … Read more
I use LINQ to Objects instructions on an ordered array. Which operations shouldn’t I do to be sure the order of the array is not changed? 6 Answers 6
As made clear in update 3 on this answer, this notation: var hash = {}; hash[X] does not actually hash the object X; it actually just converts X to a string (via .toString() if it’s an object, or some other built-in conversions for various primitive types) and then looks that string up, without hashing it, … Read more
Why does the C++ STL not provide any “tree” containers, and what’s the best thing to use instead? I want to store a hierarchy of objects as a tree, rather than use a tree as a performance enhancement… 15 Answers 15
Is there any way I can separate a List<SomeObject> into several separate lists of SomeObject, using the item index as the delimiter of each split? Let me exemplify: I have a List<SomeObject> and I need a List<List<SomeObject>> or List<SomeObject>[], so that each of these resulting lists will contain a group of 3 items of the … Read more
When is it better to use a List vs a LinkedList? 15 Answers 15
Suppose we have two stacks and no other temporary variable. Is to possible to “construct” a queue data structure using only the two stacks? 21 Answers 21