- 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 at the End of the Doubly Linked list
Algorithm to insert a
node at the front
Step 1: IF PTR =
NULL
Write OVERFLOW
Go to Step 9
[END OF IF]
Step 4: SET
NEW_NODE -> DATA = VAL
Step 5: SET
NEW_NODE -> PREV = NULL
Step 6: SET NEW_NODE -> NEXT = HEAD
Step 7: SET HEAD -> PREV = NEW_NODE
Step 8: SET HEAD = NEW_NODE
Step 9: EXIT
Algorithm to insert a
node at the end
Step 1: IF PTR =
NULL
Write OVERFLOW
Go to Step 11
[END OF IF]
Step 2: SET
NEW_NODE -> DATA = VAL
Step 3: SET
NEW_NODE -> NEXT = NULL
Step 4: SET TEMP
= HEAD
Step 5: Repeat
Step 6 while TEMP -> NEXT! = NULL
Step 6: SET TEMP
= TEMP -> NEXT
[END OF
LOOP]
Step 7: SET TEMP
-> NEXT = NEW_NODE
Step 8: SET
NEW_NODE -> PREV = TEMP
Step 9: EXIT
Algorithm to insert a
node at the specific position
Step 1: IF PTR =
NULL
Write OVERFLOW
Go to Step 13
[END OF IF]
Step 2: SET
NEW_NODE -> DATA = VAL
Step 3: SET
NEW_NODE -> NEXT = NULL
Step 4: SET TEMP
= HEAD
Step 5: SET I = 0
Step 6: REPEAT 7
to 9 until I<LOC
Step 7: SET TEMP
= TEMP -> NEXT
Step 8: IF TEMP =
NULL
WRITE "LESS THAN DESIRED NO.
OF ELEMENTS"
GOTO STEP 13
[END OF IF]
[END OF LOOP]
Step 9: SET
NEW_NODE -> NEXT = TEMP -> NEXT
Step 10: SET
NEW_NODE -> PREV = TEMP
Step 11: SET TEMP
-> NEXT = NEW_NODE
Step 12: SET TEMP
-> NEXT -> PREV = NEW_NODE
Step 13: EXIT