Explore tens of thousands of sets crafted by our community.
Common Data Structures
15
Flashcards
0/15
Stack
LIFO (Last In First Out) linear data structure. Usage: Undo mechanisms, syntax parsing. Complexity: Access - O(n), Search - O(n), Insertion - O(1), Deletion - O(1).
B-Tree
A self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. Commonly used in databases. Complexity: Access - O(log n), Search - O(log n), Insertion - O(log n), Deletion - O(log n).
Skip List
A data structure that allows fast search within an ordered sequence of elements. Levels are added to the list with coin flip. Usage: Fast search equivalent to balanced tree. Complexity: Access - O(log n), Search - O(log n), Insertion - O(log n), Deletion - O(log n).
Binary Search Tree
A node-based binary tree data structure which has the following properties: left subtree contains only nodes with keys less than the node's key, the right subtree only nodes with keys greater than the node's key. Usage: Maintain a dynamically changing dataset in sorted order. Complexity: Access - O(log n), Search - O(log n), Insertion - O(log n), Deletion - O(log n).
Array
A collection of elements identified by index or key. Usage: Storing and accessing sequential data. Complexity: Access - O(1), Search - O(n), Insertion - O(n), Deletion - O(n).
Trie
A specialized tree-like data structure that is used to store associative data structures. Usage: Autocomplete, spell checking. Complexity: Access - O(length of key), Search - O(length of key), Insertion - O(length of key), Deletion - O(length of key).
Graph
Composed of a finite set of vertices, also called nodes, and a set of edges which connect a pair of nodes. Usage: Model networks, relationships. Complexity: Depends on representation (adjacency matrix or list) and graph details (directed/undirected, weight/unweighted).
Heap
A specialized tree-based data structure which is essentially an almost complete tree that satisfies the heap property. For a max heap, this property is that for any given node i, the value of i is greater than or equal to the value of its children. Usage: Priority queues, efficient sorting. Complexity: Access - O(1) to max/min element, Search - O(n), Insertion - O(log n), Deletion - O(log n).
Linked List
A linear collection of data elements, called nodes, each pointing to the next node. Usage: Efficient insertion/deletion. Complexity: Access - O(n), Search - O(n), Insertion - O(1), Deletion - O(1).
Queue
FIFO (First In First Out) linear data structure. Usage: Order processing, messaging queues. Complexity: Access - O(n), Search - O(n), Insertion - O(1), Deletion - O(1).
Hash Table
A data structure which implements an associative array abstract data type, a structure that can map keys to values. Usage: Quick lookup, insert, and delete. Complexity: Access - N/A, Search - O(1) average, O(n) worst, Insertion - O(1) average, O(n) worst, Deletion - O(1) average, O(n) worst.
Red-Black Tree
A kind of self-balancing binary search tree in computer science. Each node of the binary tree has an extra bit, and that bit is often interpreted as the color (red or black). Usage: Real-time data access where the data is constantly being inserted and removed. Complexity: Access - O(log n), Search - O(log n), Insertion - O(log n), Deletion - O(log n).
AVL Tree
A self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for all nodes. Usage: Sorted data access with emphasis on insertion/deletion over search efficiency. Complexity: Access - O(log n), Search - O(log n), Insertion - O(log n), Deletion - O(log n).
Dynamic Array
Similar to an array but with dynamic resizing. Usage: When you need random access and variable size. Complexity: Access - O(1), Search - O(n), Insertion (amortized) - O(1), Deletion - O(n).
Bloom Filter
A probabilistic data structure that tests whether an element is a member of a set. False positive matches are possible, but false negatives are not. Usage: Caching, checking if an object is in a set without exact retrieval. Complexity: Access - N/A, Search - O(k), Insertion - O(k), Deletion - N/A.
© Hypatia.Tech. 2024 All rights reserved.