Activity 1: Linked List
-
Task 1: Implement a
Nodeclass to represent an element in a linked list with propertiesvalueandnext. -
Task 2: Implement a
LinkedListclass with methods to add a node to the end, remove a node from the end, and display all nodes.
Activity 2: Stack
-
Task 3: Implement a
Stackclass with methodspush(add element), pop (remove element), andpeek(view the top element). -
Task 4: Use the
Stackclass to reverse a string by pushing all characters onto the stack and then popping them off.
Activity 3: Queue
-
Task 5: Implement a
Queueclass with methods enqueue (add element),dequeue(remove element), andfront(view the first element). -
Task 6: Use the
Queueclass to simulate a simple printer queue where print jobs are added to the queue and processed in order.
Activity 4: Binary Tree
-
Task 7: Implement a
TreeNodeclass to represent a node in a binary tree with propertiesvalue,left, andright. -
Task 8: Implement a
BinaryTreeclass with methods for inserting values and performing in-order traversal to display nodes.
Activity 5: Graph (Optional)
-
Task 9: Implement a
Graphclass with methods to add vertices, add edges, and perform a breadth-first search (BFS). -
Task 10: Use the
Graphclass to represent a simple network and perform BFS to find the shortest path between two nodes.
-
Linked List Script: Write a script that implements a linked list with methods to add, remove, and display nodes.
-
Stack Script: Create a script that implements a stack and uses it to reverse a string.
-
Queue Script: Write a script that implements a queue and simulates a printer queue.
-
Binary Tree Script: Create a script that implements a binary tree with insertion and in-order traversal methods.
-
Graph Script: Write a script that implements a graph and performs breadth-first search (optional).
By the end of these activities, you will:
-
Implement and use linked lists for dynamic data storage.
-
Use stacks for LIFO (Last-In-First-Out) operations and reverse data.
-
Use queues for FIFO (First-in-First-Out) operations and simulate real-world scenarios.
-
Implement binary trees for hierarchical data storage and traversal.
-
Understand and use graphs for network representations and pathfinding (optional).
