From d00d9ac6123f8ff3dc4a1854a8857b508cf8d705 Mon Sep 17 00:00:00 2001 From: Surani02 Date: Mon, 16 Oct 2023 19:35:38 +0530 Subject: [PATCH 1/8] Added Queues directory and queue.md --- en/Data Structures/Queues/queue.md | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 en/Data Structures/Queues/queue.md diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md new file mode 100644 index 00000000..433d04b7 --- /dev/null +++ b/en/Data Structures/Queues/queue.md @@ -0,0 +1,52 @@ +#Queue + +##Description: +A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. It is often compared to a real-world queue of people waiting in line. The element that is added first is the one that gets removed first. Queues are commonly used for various applications, such as task scheduling, managing requests, and more. + +###Time Complexity: +Enqueue (Insertion): O(1) +Dequeue (Removal): O(1) +Peek (Accessing the front element): O(1) + +###Space Complexity: +O(n), where n is the number of elements in the queue. + +##Applications: +1) Task scheduling +2) Print job management +3) Breadth-first search (BFS) in graph algorithms +4) Simulating real-world scenarios +5) Handling requests in a web server + +##Founder's Name: +The concept of a queue in computer science is not attributed to a specific individual. It's a fundamental data structure used in various computer science applications. + +##Queue Operations: + +1) Initialize a Queue: +-Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. +2) Enqueue (Insertion): +-To add an element to the queue, insert it at the rear (end) of the queue. +-Increment the rear pointer to point to the newly added element. +-Ensure the queue remains in the correct order, following the FIFO principle. +3) Dequeue (Removal): +-To remove an element from the queue, take it from the front. +-Increment the front pointer to point to the next element in the queue. +-Make sure to handle the case when the queue becomes empty. +4) Peek (Accessing the Front Element): +-To access the element at the front of the queue without removing it, simply refer to the front element. +-This is useful for checking what's at the front of the queue without altering its contents. +5) Check if Queue is Empty: +-You can determine if the queue is empty by comparing the front and rear pointers. If they are equal, the queue is empty. +6) Check if Queue is Full (if using a fixed-size array): +-In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. + +##Sourse: +-[Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) +##Video URL: +-[Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) +-[Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) +-[Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) + +##Others: +Queues can be implemented using arrays, linked lists, or specialized queue data structures depending on the specific requirements. They are crucial in scenarios where tasks or data need to be processed in a specific order, ensuring fairness and proper management. From 7d57b258ef4528f0572cab62ace69687154122b8 Mon Sep 17 00:00:00 2001 From: Surani02 Date: Mon, 16 Oct 2023 19:55:00 +0530 Subject: [PATCH 2/8] Added Queues directory and queue.md --- en/Data Structures/Queues/queue.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md index 433d04b7..ad1b7e61 100644 --- a/en/Data Structures/Queues/queue.md +++ b/en/Data Structures/Queues/queue.md @@ -1,27 +1,27 @@ -#Queue +# Queue -##Description: +## Description: A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. It is often compared to a real-world queue of people waiting in line. The element that is added first is the one that gets removed first. Queues are commonly used for various applications, such as task scheduling, managing requests, and more. -###Time Complexity: +### Time Complexity: Enqueue (Insertion): O(1) Dequeue (Removal): O(1) Peek (Accessing the front element): O(1) -###Space Complexity: +### Space Complexity: O(n), where n is the number of elements in the queue. -##Applications: +## Applications: 1) Task scheduling 2) Print job management 3) Breadth-first search (BFS) in graph algorithms 4) Simulating real-world scenarios 5) Handling requests in a web server -##Founder's Name: +## Founder's Name: The concept of a queue in computer science is not attributed to a specific individual. It's a fundamental data structure used in various computer science applications. -##Queue Operations: +## Queue Operations: 1) Initialize a Queue: -Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. @@ -41,12 +41,12 @@ The concept of a queue in computer science is not attributed to a specific indiv 6) Check if Queue is Full (if using a fixed-size array): -In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. -##Sourse: +## Sourse: -[Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) -##Video URL: +## Video URL: -[Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) -[Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) -[Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) -##Others: +## Others: Queues can be implemented using arrays, linked lists, or specialized queue data structures depending on the specific requirements. They are crucial in scenarios where tasks or data need to be processed in a specific order, ensuring fairness and proper management. From 8be599cc33db8a181272fc8430846e13fe1694e6 Mon Sep 17 00:00:00 2001 From: Surani02 Date: Mon, 16 Oct 2023 20:02:14 +0530 Subject: [PATCH 3/8] Added Queues directory and queue.md --- en/Data Structures/Queues/queue.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md index ad1b7e61..3e52eb0f 100644 --- a/en/Data Structures/Queues/queue.md +++ b/en/Data Structures/Queues/queue.md @@ -18,9 +18,6 @@ O(n), where n is the number of elements in the queue. 4) Simulating real-world scenarios 5) Handling requests in a web server -## Founder's Name: -The concept of a queue in computer science is not attributed to a specific individual. It's a fundamental data structure used in various computer science applications. - ## Queue Operations: 1) Initialize a Queue: From 03843215dd0ceec588a734f768afd33359be8c62 Mon Sep 17 00:00:00 2001 From: Surani02 Date: Mon, 16 Oct 2023 20:05:05 +0530 Subject: [PATCH 4/8] Added Queues directory and queue.md --- en/Data Structures/Queues/queue.md | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md index 3e52eb0f..4ff2f466 100644 --- a/en/Data Structures/Queues/queue.md +++ b/en/Data Structures/Queues/queue.md @@ -20,30 +20,30 @@ O(n), where n is the number of elements in the queue. ## Queue Operations: -1) Initialize a Queue: --Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. -2) Enqueue (Insertion): --To add an element to the queue, insert it at the rear (end) of the queue. +1) Initialize a Queue: +- Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. +2) Enqueue (Insertion): +- To add an element to the queue, insert it at the rear (end) of the queue. -Increment the rear pointer to point to the newly added element. -Ensure the queue remains in the correct order, following the FIFO principle. -3) Dequeue (Removal): --To remove an element from the queue, take it from the front. --Increment the front pointer to point to the next element in the queue. --Make sure to handle the case when the queue becomes empty. -4) Peek (Accessing the Front Element): --To access the element at the front of the queue without removing it, simply refer to the front element. --This is useful for checking what's at the front of the queue without altering its contents. -5) Check if Queue is Empty: --You can determine if the queue is empty by comparing the front and rear pointers. If they are equal, the queue is empty. -6) Check if Queue is Full (if using a fixed-size array): --In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. +3) Dequeue (Removal): +- To remove an element from the queue, take it from the front. +- Increment the front pointer to point to the next element in the queue. +- Make sure to handle the case when the queue becomes empty. +4) Peek (Accessing the Front Element): +- To access the element at the front of the queue without removing it, simply refer to the front element. +- This is useful for checking what's at the front of the queue without altering its contents. +5) Check if Queue is Empty: +- You can determine if the queue is empty by comparing the front and rear pointers. If they are equal, the queue is empty. +6) Check if Queue is Full (if using a fixed-size array): +- In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. ## Sourse: --[Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) +- [Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) ## Video URL: --[Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) --[Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) --[Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) +- [Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) +- [Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) +- [Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) ## Others: Queues can be implemented using arrays, linked lists, or specialized queue data structures depending on the specific requirements. They are crucial in scenarios where tasks or data need to be processed in a specific order, ensuring fairness and proper management. From 79c82564ab6bd0b9df7153603aa5d714f2867a50 Mon Sep 17 00:00:00 2001 From: Surani02 Date: Wed, 18 Oct 2023 19:50:11 +0530 Subject: [PATCH 5/8] Added comments to the AnimatedButtons.html --- en/Data Structures/Queues/queue.md | 66 ++++++++++++------------------ 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md index 4ff2f466..53f3ba2d 100644 --- a/en/Data Structures/Queues/queue.md +++ b/en/Data Structures/Queues/queue.md @@ -1,49 +1,35 @@ # Queue -## Description: +## Description + A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. It is often compared to a real-world queue of people waiting in line. The element that is added first is the one that gets removed first. Queues are commonly used for various applications, such as task scheduling, managing requests, and more. -### Time Complexity: -Enqueue (Insertion): O(1) -Dequeue (Removal): O(1) -Peek (Accessing the front element): O(1) - -### Space Complexity: -O(n), where n is the number of elements in the queue. - -## Applications: -1) Task scheduling -2) Print job management -3) Breadth-first search (BFS) in graph algorithms -4) Simulating real-world scenarios -5) Handling requests in a web server - -## Queue Operations: - -1) Initialize a Queue: -- Create an empty queue data structure. You can implement a queue using an array, linked list, or other data structures, depending on your specific requirements. -2) Enqueue (Insertion): -- To add an element to the queue, insert it at the rear (end) of the queue. --Increment the rear pointer to point to the newly added element. --Ensure the queue remains in the correct order, following the FIFO principle. -3) Dequeue (Removal): -- To remove an element from the queue, take it from the front. -- Increment the front pointer to point to the next element in the queue. -- Make sure to handle the case when the queue becomes empty. -4) Peek (Accessing the Front Element): -- To access the element at the front of the queue without removing it, simply refer to the front element. -- This is useful for checking what's at the front of the queue without altering its contents. -5) Check if Queue is Empty: -- You can determine if the queue is empty by comparing the front and rear pointers. If they are equal, the queue is empty. -6) Check if Queue is Full (if using a fixed-size array): -- In cases where a fixed-size array is used to implement a queue, check if the rear pointer has reached the maximum size of the array to determine if the queue is full. - -## Sourse: +## Queue Operations + +1) Enqueue (Push): This operation is used to add an item to the back or end of the queue. It's equivalent to "pushing" an item onto the queue. When you enqueue an item, it becomes the last item in the queue. + +2) Dequeue (Pop): Dequeue is the operation used to remove and return the front item from the queue. The item that has been in the queue the longest (the front item) is the one removed. After dequeuing an item, the next item in the queue becomes the new front. + +3) Peek (Front): This operation is used to view the front item in the queue without removing it. It provides a way to examine the item at the front of the queue without actually dequeuing it. + +4) isEmpty: This operation checks whether the queue is empty. If the queue contains no items, it returns true; otherwise, it returns false. + +## Sourse + - [Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) -## Video URL: + +## Video URL + - [Queue in Data Structure](https://www.youtube.com/watch?v=zp6pBNbUB2U) - [Implementation of Queue using Arrays](https://www.youtube.com/watch?v=YqrFeU90Coo) - [Queue Implementation using Linked List in C](https://www.youtube.com/watch?v=RN1wzY_tnYU) -## Others: -Queues can be implemented using arrays, linked lists, or specialized queue data structures depending on the specific requirements. They are crucial in scenarios where tasks or data need to be processed in a specific order, ensuring fairness and proper management. +## Implementation + +1) Queue Implementation Using Lists (Arrays) + +In this approach, you can use a list (or array) to represent a queue. You will maintain two pointers, one pointing to the front of the queue and another pointing to the back. The front pointer keeps track of the element to be dequeued, and the back pointer keeps track of where new elements should be enqueued. + +2) Queue Implementation Using a Linked List + +In this approach, you can use a linked list to implement a queue. You maintain two pointers, one pointing to the front (head) of the queue and another pointing to the back (tail). Enqueueing involves adding a new node at the tail, and dequeueing involves removing the node at the head. From 3612da8ee01dc0666b988efa3216f193537bb570 Mon Sep 17 00:00:00 2001 From: Surani02 Date: Wed, 18 Oct 2023 20:03:42 +0530 Subject: [PATCH 6/8] Added Queues directory and queue.md --- en/Data Structures/Queues/queue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/Data Structures/Queues/queue.md b/en/Data Structures/Queues/queue.md index 53f3ba2d..93d83066 100644 --- a/en/Data Structures/Queues/queue.md +++ b/en/Data Structures/Queues/queue.md @@ -14,7 +14,7 @@ A queue is a linear data structure that follows the First-In-First-Out (FIFO) pr 4) isEmpty: This operation checks whether the queue is empty. If the queue contains no items, it returns true; otherwise, it returns false. -## Sourse +## Source - [Queue Data Structure](https://www.geeksforgeeks.org/queue-data-structure/) From fb2efc7d357bdd11e0359cf12e351f230bc4923f Mon Sep 17 00:00:00 2001 From: Surani02 Date: Sun, 22 Oct 2023 21:26:29 +0530 Subject: [PATCH 7/8] Added video explanation link to Kadane's Algorithm.md --- en/Dynamic Programming/Kadane's Algorithm.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/en/Dynamic Programming/Kadane's Algorithm.md b/en/Dynamic Programming/Kadane's Algorithm.md index 6e53f07f..44e8c7bd 100644 --- a/en/Dynamic Programming/Kadane's Algorithm.md +++ b/en/Dynamic Programming/Kadane's Algorithm.md @@ -111,3 +111,7 @@ largest_sum = max(5, 6) = 6 ### Code Implementation Links - [Python](https://github.com/TheAlgorithms/Python/blob/252df0a149502143a14e7283424d40b785dd451c/maths/kadanes.py) + +### Video Explanation Link + +- https://www.youtube.com/watch?v=86CQq3pKSUw From 14cccbef92e88d0a15e85bd1c6dc89346a30334e Mon Sep 17 00:00:00 2001 From: Surani02 Date: Sun, 22 Oct 2023 21:43:32 +0530 Subject: [PATCH 8/8] Added video explanation link to Kadane's Algorithm.md --- en/Dynamic Programming/Kadane's Algorithm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/Dynamic Programming/Kadane's Algorithm.md b/en/Dynamic Programming/Kadane's Algorithm.md index 44e8c7bd..1b82136d 100644 --- a/en/Dynamic Programming/Kadane's Algorithm.md +++ b/en/Dynamic Programming/Kadane's Algorithm.md @@ -114,4 +114,4 @@ largest_sum = max(5, 6) = 6 ### Video Explanation Link -- https://www.youtube.com/watch?v=86CQq3pKSUw +- [Kadane's Algorithm to Maximum Sum Subarray Problem](https://www.youtube.com/watch?v=86CQq3pKSUw)