From 166fc852f0c3f0e8a6897bd09e3f37be20aa5ec2 Mon Sep 17 00:00:00 2001
From: "yassin.elhakoun" <yassin.el-hakouni@etu.hesge.ch>
Date: Tue, 12 Dec 2023 11:09:35 +0100
Subject: [PATCH] =?UTF-8?q?Update=20cours=5F11.md=20(Modif=20du=20modulo?=
 =?UTF-8?q?=20dans=20l'=C3=A9galit=C3=A9=20pour=20=C3=A9viter=20des=20erre?=
 =?UTF-8?q?urs=20arriv=C3=A9=20en=20fin=20de=20queue)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 slides/cours_11.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/slides/cours_11.md b/slides/cours_11.md
index 63be99a..d4ac7a0 100644
--- a/slides/cours_11.md
+++ b/slides/cours_11.md
@@ -584,7 +584,7 @@ typedef struct _queue {
 ```C
 void queue_enqueue(queue *fa, int val) {
     if ((fa->head == 0 && fa->tail == fa->capacity-1) ||
-            (fa->tail == (fa->head-1) % (fa->capacity-1))) {
+            (fa->tail == (fa->head - 1 + fa->capacity) % fa->capacity) {
         return; // queue is full
     }
     if (fa->head == -1) { // queue was empty
-- 
GitLab