Data Structure Visualizations

Frequently Asked Questions

  1. Sometimes when I insert a element into a BST or other ordered data structure, I get strange behavior -- "-2" seems to be smaller than "-3". What's going on?
    • We use string comparisons for everything, so "-2" is in fact less than "-3" lexicographically. We tried to mitigate confusion somewhat by automatically converting positive integers into equivalent numbers with leading zeroes, so that positive integers would always be ordered as expected (though negative numbers are alas off). It turns out that if you are trying to sort a group of any strings, using a mixed comparison strategy gets confusing fast -- how should 10.4 compare to 3.1.2? What about 3A -- is that a string or a hexidecimal number? What about AF? Should BC come before or after AFF? We made the executive decision to just do string comparisons everywhere for consitency.
  2. How can I get this to work on my cellphone, which has a very small screen?
    • If you change the canvas size to something that seems reasonable for your device, we will use a cookie to remember your preferred size. Then reload the page, and you should be set! Cell Phones are a little tricky, since their screens are so small -- the iPhone 4 seems to work well for most algorithms, with a width of 500 and a height of 300 (though the sorting algorithms really require a width of 900 to see everything, and graph algorithms need a width of 1000 to see everything.) With iOS devices, you can set the canvas size to a larger value than can be dipslayed at once, though you will then need to do a bit of zooming in/out or scrolling.
  3. Wait ... you are using cookies?
    • Only for remembering your preferred width/height/speed. Everything will still work if you disable cookies, you just won't get the extra convienence of having the exact right size for your device. We aren't doing tracking of any kind.
  4. I think I've found a bug ...
    • Please email me any bug reports, at galles <at> usfca <dot> edu. The more specific, the better (that is, excatly what sequence of operations lead to the undesired behavior).
  5. Can I use these materials in my classes?
    • Certainly! I'd prefer that you just link to my pages rather than cache anything locally so that your students will get the most up-to-date version of everything. If you do use this in your class, please drop me a line to let me know about it, I'm curious to see who else will find this useful.
  6. Can I use this material as a base for my own visualizations?
    • Yes! See the source code page for a simple tutorial and a tarball with everything you need. Note that updates to the source code release are not made as quickly as updates to the visualziations themselves, so not all of the visualziations may be in the tarball at any given time. I plan to update the source code at least once a month or so, so it shouldn't get too far out of date. If you do use my code, please leave in the copyright information at the beginning of each source file, and put a link to these pages from the page where your visualizations are located. If you create something really cool, let me know and I can link to it.
  7. What's next?
    • Converting the remainder of the java-only visualziations to javascript (only Huffman Coding and lists left!)
    • Adding a suite of simple recursion visualziations (factorial, reversing a list, generic tree operations, etc). Similar to the Dynamic Programming: Fibonacci visualziation, but with some more detail (contents of the call stack, etc)
    • Adding more Dynamic Programming visualziations
    • Adding visualzations of translations and rotations of simple objects (in 2D, or 3D if I'm feeling ambitious). Mostly because those visualziations would be handy for my Game Engineering classes.