bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit 853960e3e05efed43a9002686970e2d48fcb8328
parent 9864ca23e2327651b1b4cadebdce2e39d3b27eb1
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Tue, 23 Jun 2026 20:10:46 +0530

more algo

Diffstat:
Asemester_2/algorithms/algo_09.md | 27+++++++++++++++++++++++++++
Asemester_2/algorithms/algo_10.md | 34++++++++++++++++++++++++++++++++++
Asemester_2/algorithms/algo_11.md | 22++++++++++++++++++++++
3 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/semester_2/algorithms/algo_09.md b/semester_2/algorithms/algo_09.md @@ -0,0 +1,26 @@ +# algo_09 + +### Problem Statement + +> Write an algorithm to insert a node after a special key value. + +## Algorithm +``` +procedure insertAfterKey(head, key) +begin + current ← head; + while(current ≠ NULL && info(current) ≠ key) + current ← next(current); + endwhile + if(current ≠ NULL) + write("Enter the value: "); + read(val); + newNode ← getnode(); + info(newNode) ← val; + next(newNode) ← next(current); + next(current) ← newNode; + else + write("Key not found in the list."); + endif +end procedure +```+ \ No newline at end of file diff --git a/semester_2/algorithms/algo_10.md b/semester_2/algorithms/algo_10.md @@ -0,0 +1,33 @@ +# algo_10 + +### Problem Statement + +> Write an algorithm to insert an element at a perticular position. + +## Algorithm +``` +procedure insertPosition(head, pos, val) +begin + newNode ← getNode(); + info(newNode) ← val; + next(newNode) ← NULL; + if(pos < 1) + write("Invalid Input."); + else if(pos = 1) + next(newNode) ← head; + head ← newNode; + else + current ← head; + for(i ← 1; i < pos && current ≠ NULL; i ← i + 1) + current ← next(current); + end for + if(current = NULL) + write("Invalid Input."); + else + next(newNode) ← next(current); + next(current) ← newNode; + endif + endif + return(head); +end procedure +```+ \ No newline at end of file diff --git a/semester_2/algorithms/algo_11.md b/semester_2/algorithms/algo_11.md @@ -0,0 +1,21 @@ +# algo_11 + +### Problem Statement + +> Write an algorithm to reverse a linked list. + +## Algorithm +``` +procedure reverse(head) +begin + q ← r ← NULL; + while(head ≠ NULL) + r ← q; + q ← head; + head ← next(head); + next(q) ← r; + end while + head ← q; + return(head); +end procedure +```+ \ No newline at end of file
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror