Comparing the three dynamic data structures of array lists.
Please respond to the discussion below using 150 words or more
Good day, all!
There are certainly a few key differences between static and dynamic data structures!
On the most basic level, as their names suggest, a dynamic data structure is resizable whereas a static data structure is fixed. According to geeksforgeeks.com article “Static Data Structure vs Dynamic Data Structure”, both types of structures can modify their elements, but a static data structure’s elements can be changed without changing the space in memory that has been allocated to it (ShivamKD. 2018, Mar 13).
Consequently, overall performance of the code is s typically slower when dealing with a dynamic data structure. This is because, for instance, when an array list is utilized, the resize function of the class must create a brand new copy of the original array and copy it to a new one. This is much less efficient than a regular array (unless the regular array itself needs to be resized).
Comparing the three dynamic data structures of array lists, linked lists, and vectors, there are some notable differences as well.
Both array lists and vectors are in the family of the List interface. Linked lists also take part in the List interface but additionally take part in the Queues interface. This addition adds more available methods for the user to utilize in their code (Programcreek.com. 2013, Mar 4. “ArrayList vs. LinkedList vs. Vector”). According to the article, vectors double in size each time they are utilized, whereas an array list only grows at a 50% rate.
As far as implementation is concerned, according to the w3spoint.com website, an array list should be utilized over a linked list if there are more get/set operations in the code. Otherwise, for add/remove operations the linked list is preferable (“ArrayList vs Linkedlist vs Vector in Java”. 2018, Mar 13). There is a very noticeable difference in their performance when comparing get/set and add/remove methods (as is demonstrated in the article). As far as vectors go, one key component associated with them is the fact that one can utilize and manipulate elements in the vector utilizing index positions. This allows for iteration over the objects within the vector similar to an array!
Thanks class and best of wishes on your upcoming assignments!