- What is a Data Structure & Types of Data Structures
- What is an Algorithm & It's Characteristics
- Asymptotic Notations
- What is Space Complexity
- Array in Data Structure
- Algorithm for Insertion in Array
- Sparse Matrix
- Introduction to a Linked List
- Algorithm to Insert a Node at the End of the Linked list
- Algorithm to Insert a Node at the Front of the Linked List
- Algorithm to Delete a Node from Linked list
- Circular Linked List
- Algorithm to Insert a Node in the Circular Linked list
- Algorithm to Delete a Node from the Circular Linked list
- Doubly Linked List
- Algorithm to Insert a Node at the End of the Doubly Linked list
- Algorithm to Delete a Node from the Doubly Linked List
- Stack Data Structure
- Algorithm to convert Infix to Postfix
- Queue Data Structure
- Circular Queue in Data Structure
Algorithm to Insert a Node in the Circular Linked list
Algorithm to insert
an element at the end of the linked list:
Step 1: IF PTR = NULL
Write OVERFLOW
Go to Step 1
[END OF IF]
Step 2: SET NEW_NODE -> DATA = VAL
Step 3: SET NEW_NODE -> NEXT = HEAD
Step 4: SET TEMP = HEAD
Step 5: Repeat Step 6 while TEMP -> NEXT! = HEAD
Step 6: SET TEMP = TEMP -> NEXT
[END OF LOOP]
Step 7: SET TEMP -> NEXT = NEW_NODE
Step 8: EXIT
Algorithm to insert an element at the
front
Step 1: IF PTR =
NULL
Write OVERFLOW
Go to Step 11
[END OF IF]
Step 2: SET NEW_NODE
-> DATA = VAL
Step 5: SET TEMP =
HEAD
Step 6: Repeat Step
8 while TEMP -> NEXT != HEAD
Step 7: SET TEMP =
TEMP -> NEXT
[END OF LOOP]
Step 8: SET NEW_NODE
-> NEXT = HEAD
Step 9: SET TEMP →
NEXT = NEW_NODE
Step 10: SET HEAD =
NEW_NODE
Step 11: EXIT
Algorithm to insert an element at specific
position
STEP 1: IF PTR = NULL
WRITE OVERFLOW
GOTO STEP 11
END OF IF
STEP 2: NEW_NODE → DATA = VAL
STEP 3: SET TEMP = HEAD
STEP 4: SET I = 0
STEP 5: REPEAT STEPS 6 AND 7 UNTIL I<LOC
STEP 6: TEMP = TEMP → NEXT
STEP 7: SET I = I + 1
STEP 8: IF TEMP = NULL
WRITE "DESIRED NODE NOT
PRESENT"
GOTO STEP 11
END OF IF
END OF LOOP
STEP 9: NENODE->NEXT → NEXT = TEMP → NEXT
STEP 10: TEMP → NEXT = NEWNODE
STEP 11: EXIT