One portion of the video that I didn't spend as much time as I would have liked on was why I chose to use Nodes as opposed to a List to implement the Queue class. The reason for this is that by using Nodes the time complexity of enqueue and dequeue would be O(1). With a list the time complexity of enqueue and dequeue would be O(1) and O(n) respectively and here is why. To append to a list which is what enqueue is (when implementing a queue with a list) is O(1). However, to remove the first item, which is what dequeue basically is, in a list with the pop method i.e my_list.pop(0) takes O(n) time since you have to move every item to the right of the item being removed one place over to the left.
Code at : https://github.com/Nathan-Patnam/Data...
Follow/Connect with me on:
/ nathan-patnam
https://github.com/Nathan-Patnam
https://www.upwork.com/fl/nathanpatnam
En esta página del sitio puede ver el video en línea What is a Queue and Implementing a Queue class in Python de Duración hora minuto segunda en buena calidad , que subió el usuario Nathan Patnam 12 febrero 2018, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 4,044 veces y le gustó 37 a los espectadores. Disfruta viendo!