/dsa-linkedlist

Data Structure and Algorithms using Linkedlist

Primary LanguageJava

dsa-linkedlist

Data Structure and Algorithms using Linkedlist

When deciding which Abstract data type to use in a music playlist, the option will depend on the specific requirements and constraints of the playlist application. The ADT which I used for this application is the linked list, which is a linear data structure that consists of a sequence of nodes, where each node stores a value and a reference to the next node in a sequence format. One of the main reasons I chose Linked lists is because they can grow or shrink in size as elements are added or removed. They are also efficient at inserting and deleting elements since these operations only require updating the references of the nodes in the list. Another advantage of using a LinkedList is that it does not require the allocation of additional memory when inserting or deleting elements, as it uses a dynamic data structure to store the elements. This can be very useful in situations where memory is a limited resource. Further, a LinkedList allows to iterate through the elements in the list in a linear fashion, which is useful for playing the songs in the playlist in a particular order. You can use a ListIterator to navigate through the list of songs and play them in either direction which I have go the maximum benefit out of this. The only drawback of using this method is that they are not efficient at accessing or searching for specific elements, since they do not support random access. I have also used Arrays to just insert certain things in this program. LinkedList better than stack because stacks needs a pre-allocated fixed amount of memory. Trees needs additional memory for pointers and other overheads. Queue might need pre-allocating a fixed amount of memory or using a dynamic array, which can lead to additional overhead. Queues only allow insertion at the end and deletion at the front, which can be less flexible compared to the LinkedList where the insertion and deletion process is far more efficient. In general, the LinkedList data structure is well-suited for use in a music playlist application because of its fast insertion and deletion, the ability to iterate through the elements in the list, and the efficient use of memory.