Sunday, November 17, 2013

Data Structures: Arrays and Arraylists


Data Structures are a way of organizing information in a certain form so that it can be stored and accessed. Each type has its own strengths and weaknesses. For example the array is a data structure that is initiated with a certain amount of holding spots for data or with certain elements already placed into the amount of slots. This data structure makes it easy to access and fill its slots buy using loops. Each slot is both filled and accessed by indexes. It should be noted that the indexes start at zero instead of one. The downside to arrays is that they are if additional slots were needed it would not be able to expand. A new array would need to be made in order to add new slots. Luckily enough there is a different data structure that is similar but allows the addition of new slot. How it avoids the problem of having limited slots is that it expands its maximum capacity as you add data into the slots. Choosing which data structure to use depends on several factors. One of them is the time it takes to do a certain action. For instance, this one makes it easy to add and access information while making it take more time to delete items while another would have easy insertion and removal but, take more time when accessing data and so on and so forth. 
Arrays

1 comment:

  1. Yo Johnathan! How are things going? You've got a lot of great content with this post. Very technical, but it could be a bit more snazzy. Perhaps a bit of paragraph separation? Anyways, liked how you brought up run time analysis. Small correction, Data structures aren't a way of organizing information, they are a way of storing information. Through storing the information you can order it. Certain data structures work best by being ordered certain ways, but you do not need to have order for many different data structures. Arrays are a good example of this. Hope you look forward to learning more about data structures as you pursue Computer Science, they're a interesting topic. =).

    ReplyDelete