data-structures-algorithms-python
data-structures-algorithms-python copied to clipboard
This tutorial playlist covers data structures and algorithms in python. Every tutorial has theory behind data structure or an algorithm, BIG O Complexity analysis and exercises that you can practice o...
https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/6_Queue/Exercise/food_ordering_system.py **Issue:** ``` def serve_orders(): time.sleep(1) while True: order = food_order_queue.dequeue() print("Now serving: ",order) time.sleep(2) ``` **Proposed below:** ``` def serve_orders(): time.sleep(1) while not food_order_queue.is_empty(): order = food_order_queue.dequeue() print("Now serving:...
https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/6_Queue/Exercise/binary_numbers.py **Issue:** ``` def produce_binary_numbers(n): numbers_queue = Queue() numbers_queue.enqueue("1") for i in range(n): front = numbers_queue.front() print(" ", front) numbers_queue.enqueue(front + "0") numbers_queue.enqueue(front + "1") numbers_queue.dequeue() ``` **Proposed below:** ```...
https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/3_LinkedList/Solution/singly_linked_list_exercise.py Proposed below : ``` if not self.head: return if self.head.val == value: self.head = self.head.next return itr = self.head prev_node = None while itr: if itr.val == value: prev_node.next...
i have tried improving **insert_at_end** method by reducing runtime from _O(n)_ to _O(1)_, please review the changes i have made, please provide a feedback , ,thank you for amazing course...
Deletion not happening when there is only one node. The code should go like this: tree = tree.delete(17)
if the last number is odd then it will not consider the last value
If the value is not there in the linked list, the condition for the stated part was not present Added that condition
The insert values should not clear the original linked list.
Even though I save the file in the same location it still raises an error.