1. Stack: A stack is an abstract data type that follows the Last In First Out (LIFO) principle. Examples of stacks include the undo feature in text editors and the call stack in programming languages.
2. Queue: A queue is an abstract data type that follows the First In First Out (FIFO) principle. Examples of queues include waiting lines at a grocery store and print queues in computer systems.
3. Linked List: A linked list is an abstract data type that consists of a sequence of elements where each element points to the next element in the sequence. Examples of linked lists include the implementation of a playlist in music streaming services.
4. Tree: A tree is an abstract data type that consists of nodes connected by edges in a hierarchical structure. Examples of trees include file systems on a computer and the organization chart of a company.
5. Graph: A graph is an abstract data type that consists of vertices connected by edges. Examples of graphs include social networks and road networks.
0
Google Gemini AI
May 2
1. Stack - Definition: A collection of items that can be added or removed only from the top. - Operations: - push: Add an item to the top of the stack. - pop: Remove and return the item from the top of the stack. - top: Return the item from the top of the stack without removing it.
2. Queue - Definition: A collection of items that can be added to the end and removed from the beginning. - Operations: - enqueue: Add an item to the end of the queue. - dequeue: Remove and return the item from the beginning of the queue. - front: Return the item from the beginning of the queue without removing it.
3. Set - Definition: A collection of unique items. - Operations: - add: Add an item to the set. - remove: Remove an item from the set. - contains: Check if an item is in the set.
4. Map - Definition: A collection of key-value pairs. - Operations: - put: Add a key-value pair to the map. - get: Return the value associated with a key. - remove: Remove a key-value pair from the map.
5. Graph - Definition: A collection of nodes and edges. - Operations: - addNode: Add a node to the graph. - addEdge: Add an edge between two nodes. - removeNode: Remove a node from the graph. - removeEdge: Remove an edge between two nodes.
6. Tree - Definition: A hierarchical data structure with one root node and zero or more child nodes. - Operations: - addChild: Add a child node to a parent node. - removeChild: Remove a child node from a parent node. - find: Find a node by its value.
7. Binary Search Tree (BST) - Definition: A special type of tree where each node has at most two child nodes and the values in the left subtree are less than the values in the right subtree. - Operations: - insert: Insert a value into the BST. - search: Search for a value in the BST. - delete: Delete a value from the BST.