Sage-Code Laboratory

SC Data Structures

Data structures are specialized formats for organizing and storing data in a computer's memory or on disk. They are used to efficiently perform operations on data in various algorithms and applications. In computer science, data structures are divided into two main categories:

Page bookmarks



Well known

The choice of data structure often depends on the specific problem being solved and the operations that are required to be performed on the data. Some structures are better suited to certain kinds of algorithms or data types, and may offer advantages in memory usage or processing time over others. These are most common data structures:


Arrays

An array is a collection of elements of same data type arranged in contiguous memory locations.

Features: Advantages: Use cases: Disadvantages:

Linked Lists

A list is a series of nodes, each containing some data and a pointer to the next node.

Features: Advantages: Use cases: Disadvantages:

Stacks

A stack is a collection of elements, with push and pop operations that allow elements to be added or removed only from the top of the stack.

Features: Advantages: Use cases: Disadvantages:

Queues

A queue is a collection of elements, where elements are inserted at the back and removed from the front.

Features: Advantages: Use cases: Disadvantages:

Heaps

A heaps is a complete binary tree in which every level of the tree is completely filled except for the last level, which is filled from left to right, and every node is greater than or equal to (or less than or equal to) its children, as per the type of heap.

Features: Advantages: Use cases: Disadvantages:

These data structures are widely used in computer science for various applications and algorithmic implementations. Let's analyze some features of these algorithms.


Trees

A tree is a hierarchical data structure consisting of nodes connected by edges, with the topmost node known as the root.

Features: Advantages: Use cases: Disadvantages:

Graphs

A graph is a collection of vertices connected by edges, where each edge can have a weight or cost associated with it.

Features: Advantages: Use cases: Disadvantages:

Hash Tables

A Hash tables is an associative array data structure that maps keys to values, with a hash function used to compute an index into an array of buckets or slots.

Features: Advantages: Use cases: Disadvantages:

Exotic Structures

Exotic data structures are less commonly used data structures that have specialized use-cases and are designed to solve specific problems. These data structures are not well-known or widely used like arrays, stacks, queues, linked lists, trees, and graphs, but they are still important concepts in computer science.

Bloom filters

Bloom filters are a probabilistic data structure used to determine whether an element is a member of a set. Bloom filters require minimal memory space and check false positives in return for false negatives.

Features: Use cases:

HyperLogLog

HyperLogLog is another probabilistic data structure like Bloom filters. It uses a fixed amount of memory to estimate the number of distinct elements in a set with high accuracy even for large datasets.

Features: Use cases:

Interval Trees

Interval trees are data structures used for searching intervals that contain or overlap a given point or interval. The Tree structures store intervals as leaf nodes and each internal Node stores the maximum end-point of the descendant intervals. This provides a fast way to find all the intervals in a tree that overlap with a given interval or point.

Features: Use cases:

Tries

Tries are tree-like data structures used to store strings with keys that share common prefixes. Tries are useful for prefix matching and search facilities in a large amount of text data.

Features: Use cases:

Wavelet trees

Wavelet Trees are data structures that encode a large array of alphanumeric characters into a sequence of binary digits that can be queried using bitwise operations. Wavelet Trees exploit the repetition of characters to compress the data and to perform queries by multiple bitwise operations in log time.

Features: Use cases:

String Representation

In programming, there are many alternative data structures that can be used as alternatives for internal representations of strings and large strings. Here are a few examples of suitable data structures:

The choice of which data structure to use depends on the specific requirements of the application, such as the size and number of strings, the operations needed to perform on the strings, and the available memory resources.


Read next: Algorithms