Sunday, November 3, 2013

Data Structures: Ways to Store Information Digitally

    Today's article will talk about some of the types of data structures that are used in Computer Science for storing data virtually. Data on the web can't just be stored like regular notes. The equivalent of writing some information down on a piece of paper would be to record the same information in a word processing document, such as Microsoft word, or a generic ".txt" file. However, when you have to store incredibly massive amounts of data, different methods must be used. For example, let's say you have trillions of names written down on a stack of papers and they have phone numbers listed next to them. If they are unorganized, it would be nearly impossible to find the one that you are looking for. Using computers, we can program algorithms that search through the information easily by storing them in different types of data structures, such as an array, or a more complex structure, like a binary tree.
JavaArray
Thanks to learn-java-tutorial for this array image!

     Certain data structures are more efficient at doing different things. For example, an array is very good at cycling through a list of things that you want to look through. For those of you that don't know what an array is, it's an arrangement of objects in rows an columns. Here is a youtube video explaining it, for those of you that are more visual learners. The most basic array would be a line of data, something one-dimensional like writing names down in a column. More complex arrays can be two-dimensional, something equivalent to writing names and numbers next to the names in a column, or even 3, 4, 5 dimensions. The only limit to the amount of dimensions an array can have is the power of your computer or integrated development environment. Another type of data structure is a binary tree, which is useful for searching through information that can be sorted by value. The tree consists of "nodes" and each node has a value and a reference to a left and right node. The left reference node will always be less than the node you're looking at and the right one will always be greater. This means that each level you go down the tree, you are cutting the searching time in half (assuming that the tree is balanced and both sides are filled).
ExampleBinaryTree
Binary Tree image from StackOverflow.com
     In addition to arrays and binary trees, there are many other data structures, such as hash tables, graphs, and other types of trees. Each one has its benefits and drawbacks related to efficiency in runtime, storage size in bytes, adding/removing elements, searching, etc. Programmers must always think about which data structures would be best to use to accomplish certain tasks, and implement them efficiently. I hope you learned something from this post about data structures and if anyone has any questions or comments, please reply below!

No comments :

Post a Comment