commit 39d9969767ff4372c6c4b039c108ed3009bf8a3d
parent 406c3d49ec9508c6560b34779c40d08c48e95830
Author: Amit Dutta <mail@amit.is-a.dev>
Date: Mon, 13 Jul 2026 21:13:23 +0530
more algo
Diffstat:
4 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/semester_2/algorithms/algo_026.md b/semester_2/algorithms/algo_026.md
@@ -0,0 +1,20 @@
+# algo_026
+
+### Problem Statement
+
+> Write an algorithm to check if the stack is full or not.
+
+## Algorithm
+```
+procedure isFull(top, n)
+begin
+ /* n represents stack size,
+ having index 0 to n-1 and 'top' is an index variable. */
+
+ if(top = n - 1)
+ return true;
+ else
+ return false;
+ endif
+end procedure
+```+
\ No newline at end of file
diff --git a/semester_2/algorithms/algo_027.md b/semester_2/algorithms/algo_027.md
@@ -0,0 +1,17 @@
+# algo_027
+
+### Problem Statement
+
+> Write an algorithm to check is the stack is empty or not.
+
+## Algorithm
+```
+procedure isEmpty(top)
+begin
+ if(top = -1)
+ return true;
+ else
+ return false;
+ endif
+end procedure
+```+
\ No newline at end of file
diff --git a/semester_2/algorithms/algo_028.md b/semester_2/algorithms/algo_028.md
@@ -0,0 +1,18 @@
+# algo_028
+
+### Problem Statement
+
+> Write an algorithm to push a element to stack.
+
+## Algorithm
+```
+procedure push(stack[], top, n, val)
+begin
+ if(top = n - 1)
+ write("Stack full, insertion not possible.");
+ else
+ top ← top + 1;
+ stack[top] ← val;
+ endif
+end procedure
+```+
\ No newline at end of file
diff --git a/semester_2/algorithms/algo_029.md b/semester_2/algorithms/algo_029.md
@@ -0,0 +1,20 @@
+# algo_029
+
+### Problem Statement
+
+> Write an algorithm to pop a element from stack.
+
+## Algorithm
+```
+procedure pop(stack[], top, n)
+begin
+ if(top = -1)
+ write("Stack is empty, deletion not possible.");
+ return;
+ else
+ x ← stack[top];
+ top ← top - 1;
+ return x;
+ endif;
+end procedure
+```+
\ No newline at end of file