The Wayback Machine - https://web.archive.org/web/20241005172442/https://www.geeksforgeeks.org/tango-tree-data-structure/
Open In App

Tango Tree Data Structure

Last Updated : 01 Feb, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

INTRODUCTION:’

Tango Tree is a data structure for efficient dynamic connectivity and range minimum/maximum query on a set of elements. It is a type of balanced binary search tree that uses finger trees as the underlying data structure to achieve fast and efficient operations. The Tango Tree is designed to support both fast insertions and deletions as well as fast minimum/maximum query operations in a dynamic setting.

Some of the key features and advantages of Tango Tree include its efficient time and space complexity, ability to support a wide range of dynamic connectivity and range minimum/maximum query problems, and its versatility as a general-purpose data structure. Tango Tree is also known for its robustness and stability, as it is less likely to degenerate into an unbalanced tree structure compared to other dynamic binary search trees.

Tango Tree is an online algorithm. It is a type of binary search tree. It is better than the offline weight balanced binary search tree as it achieves a competitive ratio of O(log{ }log{ }n)  as compared to competitive ratio of O(log n)  of offline weight balanced binary search tree. It takes only O(log{ }log{ }n)  of additional bits of memory at every node of the tree to increase the performance over weight balanced binary search tree. Tango tree is conceptually a tree of trees as it partitions a binary search tree into preferred paths and non preferred paths and these preferred paths are themselves stored in the form of auxiliary trees. Preferred child and Preferred Paths Preferred child of any node of Tango tree is defined as the most recently touched child by a normal binary search tree lookup technique. Elaborating more on preferred child let us assume a subtree T rooted at node n with right child as p and left child as q. Call p as the preferred child of n if most recently accessed node of subtree rooted at n is present in the subtree rooted at p. A Preferred path is defined as the path starting from root node and following all the preferred children along a path to reach a leaf node.

tree_

Tango Tree

Auxiliary Trees for Preferred Paths A preferred path is represented by storing the nodes of the preferred path in a balanced binary search tree specifically red black tree. Then, for every non-leaf node of path P there is a non-preferred child q  . This non preferred child acts as the root of the new auxiliary tree and then attach this new auxiliary tree rooted at q  to its parent and in this way, it is easy to link the auxiliary trees together. There is also option to store some extra information in each node of the auxiliary tree as per our own needs like minimum depth of the nodes in the subtree below it, etc. Operations on Tango Tree The two most common operations on Tango Trees are Searching and Updating

  • Updating in a Tango Tree
    1. Cut process
    2. Join process
  • Searching in a tango tree

ADVANTAGES OR DISADVANTAGES:
Advantages of Tango Tree:

  1. Efficiency: Tango Tree provides fast and efficient dynamic connectivity and range minimum/maximum query operations, with an average time complexity of O(log n) for most operations.
  2. Dynamic: Tango Tree is a dynamic data structure that can handle insertions and deletions of elements in real-time, making it suitable for growing and changing datasets.
  3. Balancing: Tango Tree uses finger trees as the underlying data structure, which ensures a balanced tree structure, reducing the risk of degeneration and maintaining efficient time complexity.
  4. Versatility: Tango Tree is a general-purpose data structure that can be used for a wide range of dynamic connectivity and range minimum/maximum query problems.
  5. Robustness: Tango Tree is known for its robustness and stability, as it is less likely to degenerate into an unbalanced tree structure compared to other dynamic binary search trees.

Disadvantages of Tango Tree:

  1. Complexity: Tango Tree is a complex data structure that requires a deeper understanding of the underlying finger trees and balanced binary search trees to implement and use effectively.
  2. Overhead: Tango Tree requires a significant amount of overhead in terms of memory and processing power, making it less suitable for resource-constrained environments.
  3. Limited usage: Tango Tree is designed specifically for dynamic connectivity and range minimum/maximum query problems, making it less suitable for other types of data structures and algorithms.


Similar Reads

Static Data Structure vs Dynamic Data Structure
Data structure is a way of storing and organizing data efficiently such that the required operations on them can be performed be efficient with respect to time as well as memory. Simply, Data Structure are used to reduce complexity (mostly the time complexity) of the code. Data structures can be two types : 1. Static Data Structure 2. Dynamic Data
4 min read
Merge Sort Tree with point update using Policy Based Data Structure
A Merge Sort Tree (MST) is a data structure that allows for efficient querying of the number of elements less than or equal to a certain value in a range of an array. It is built using a divide-and-conquer approach similar to the merge sort algorithm, where the array is recursively divided into two halves and a tree is constructed to represent the
7 min read
Introduction to Splay tree data structure
Splay tree is a self-adjusting binary search tree data structure, which means that the tree structure is adjusted dynamically based on the accessed or inserted elements. In other words, the tree automatically reorganizes itself so that frequently accessed or inserted elements become closer to the root node. The splay tree was first introduced by Da
15+ min read
Introduction to Finger search tree Data Structure
A finger search tree is a data structure that is designed to allow for efficient search and access of data in a set or a sequence. It is a type of binary search tree that uses a "finger" or a reference to a particular element in the tree to quickly find and retrieve other elements. In this article, we will explore the types, advantages, disadvantag
15+ min read
Tree Data Structure
Tree Data Structure is a non-linear data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes. Table of Content What is Tree Data Structure?Terminologies In Tree Data StructureTypes of Tree Data StructureApplications of Tree Data StructureBasic
7 min read
Applications of tree data structure
A tree is a type of data structure that represents a hierarchical relationship between data elements, called nodes. The top node in the tree is called the root, and the elements below the root are called child nodes. Each child node may have one or more child nodes of its own, forming a branching structure. The nodes at the bottom of the tree, whic
4 min read
Introduction to Tree Data Structure
Tree data structure is a specialized data structure to store data in hierarchical manner. It is used to organize and store data in the computer to be used more effectively. It consists of a central node, structural nodes, and sub-nodes, which are connected via edges. We can also say that tree data structure has roots, branches, and leaves connected
15+ min read
Binary Tree Data Structure
A Binary Tree Data Structure is a hierarchical data structure in which each node has at most two children, referred to as the left child and the right child. It is commonly used in computer science for efficient storage and retrieval of data, with various operations such as insertion, deletion, and traversal. Introduction: Introduction to Binary Tr
4 min read
AVL Tree Data Structure
An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. The difference between the heights of the left subtree and the right subtree for any node is known as the balance factor of the node. The AVL tree is named after its inventors, Georgy
3 min read
Is array a Data Type or Data Structure?
What is Data Type? In computer programming, a data type is a classification of data that determines the type of values that can be stored, manipulated, and processed. It tells the computer what kind of data a particular variable or constant can hold, and what operations can be performed on that data. Common data types include integers, floating-poi
8 min read
Data Structure Alignment : How data is arranged and accessed in Computer Memory?
Data structure alignment is the way data is arranged and accessed in computer memory. Data alignment and Data structure padding are two different issues but are related to each other and together known as Data Structure alignment. Data alignment: Data alignment means putting the data in memory at an address equal to some multiple of the word size.
4 min read
Difference between data type and data structure
Data Type A data type is the most basic and the most common classification of data. It is this through which the compiler gets to know the form or the type of information that will be used throughout the code. So basically data type is a type of information transmitted between the programmer and the compiler where the programmer informs the compile
4 min read
Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
In this article, we will discuss the complexity of different operations in binary trees including BST and AVL trees. Before understanding this article, you should have a basic idea about Binary Tree, Binary Search Tree, and AVL Tree. The main operations in a binary tree are: search, insert and delete. We will see the worst-case time complexity of t
4 min read
Convert a Generic Tree(N-array Tree) to Binary Tree
Prerequisite: Generic Trees(N-array Trees) In this article, we will discuss the conversion of the Generic Tree to a Binary Tree. Following are the rules to convert a Generic(N-array Tree) to a Binary Tree: The root of the Binary Tree is the Root of the Generic Tree.The left child of a node in the Generic Tree is the Left child of that node in the B
13 min read
Overview of Graph, Trie, Segment Tree and Suffix Tree Data Structures
Introduction:Graph: A graph is a collection of vertices (nodes) and edges that represent relationships between the vertices. Graphs are used to model and analyze networks, such as social networks or transportation networks.Trie: A trie, also known as a prefix tree, is a tree-like data structure that stores a collection of strings. It is used for ef
10 min read
How to set the order in subnodes of a tree structure?
What is the order of a tree?The arrangement or positioning of a tree structure's nodes and subnodes in relation to one another is referred to as the tree structure's "order." The preferred order of each node's subnodes can be determined by a specific feature or characteristic of each node, such as a number or text. We can sort a tree structure's no
5 min read
Applications of Queue Data Structure
Introduction : A queue is a linear data structure that follows the "first-in, first-out" (FIFO) principle. It is a collection of elements that supports two primary operations - enqueue and dequeue. In the enqueue operation, an element is added to the back of the queue, while in the dequeue operation, an element is removed from the front of the queu
5 min read
Data Structure for a single resource reservations
Design a data structure to do reservations of future jobs on a single machine under following constraints. Every job requires exactly k time units of the machine. The machine can do only one job at a time. Time is part of the system. Future Jobs keep coming at different times. Reservation of a future job is done only if there is no existing reserva
7 min read
A data structure for n elements and O(1) operations
Propose a data structure for the following: The data structure would hold elements from 0 to n-1. There is no order on the elements (no ascending/descending order requirement) The complexity of the operations should be as follows: Insertion of an element – O(1) Deletion of an element – O(1) Finding an element – O(1) We strongly recommend to minimiz
4 min read
Applications of Graph Data Structure
A graph is a non-linear data structure, which consists of vertices(or nodes) connected by edges(or arcs) where edges may be directed or undirected. In Computer science graphs are used to represent the flow of computation.Google maps uses graphs for building transportation systems, where intersection of two(or more) roads are considered to be a vert
3 min read
Which data structure is used by Map?
What is a Map? Before learning the data structure used by a map, let us have an overlook of map. Map is the part of the STL library that stores key value pairs in it and no two values have the same keys but the different keys can store similar values. The map stores keys in sorted order. These are some functions which map uses with their Time Compl
2 min read
Applications of linked list data structure
A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers as shown in the below image: Applications of linked list in computer science:Implementation of stacks and queuesImplementation of graphs: Adjacency list representation of graphs is th
5 min read
Top 50 Problems on Heap Data Structure asked in SDE Interviews
A Heap is a special Tree-based Data Structure in which the tree is a complete binary tree. Generally, heaps are of two types: Max-Heap and Min-Heap. To know more about this Data Structure in-depth refer to the Tutorial on Heap Data-Structure. Given below are the most frequently asked interview questions on Heaps:  Easy Interview Questions on Heap D
2 min read
Remove duplicates from unsorted array using Map data structure
Given an unsorted array of integers, print the array after removing the duplicate elements from it. We need to print distinct array elements according to their first occurrence. Examples: Input : arr[] = { 1, 2, 5, 1, 7, 2, 4, 2} Output : 1 2 5 7 4 Explanation : {1, 2} appear more than one time. Approach : Take a hash map, which will store all the
4 min read
Map Policy Based Data Structure in g++
There are some data structures that are supported by g++ compiler and are not a part of the C++ standard library. One of these is: Policy-Based Data Structure, which is used for high-performance, flexibility, semantic safety, and conformance to the corresponding containers in std. This can also be used as a map, to store key and a value (pair) in a
3 min read
Trie Data Structure using smart pointer and OOP in C++
We will implement trie using smart pointers in C++ and OOP. Here, We have already discussed the implementation of trie data using recursionIn our implementation node of a trie look like : C/C++ Code class TrieNode{ public: // Use of shared_ptr for storing Children // Pointers of TrieNode shared_ptr children[ALPHABET_SIZE]; // Tracks whether If this
6 min read
Remove duplicates from unsorted array using Set data structure
Given an unsorted array of integers, print the array after removing the duplicate elements from it. We need to print distinct array elements according to their first occurrence. Examples: Input: arr[] = { 1, 2, 5, 1, 7, 2, 4, 2} Output: 1 2 5 7 4 Explanation: {1, 2} appear more than one time. Input: arr[] = { 3, 3, 4, 1, 1} Output: 3 4 1 Approach:
3 min read
Count-Min Sketch Data Structure with Implementation
The Count-Min Sketch is a probabilistic data structure and is defined as a simple technique to summarize large amounts of frequency data. Count-min sketch algorithm talks about keeping track of the count of things. i.e, How many times an element is present in the set. What is Count-Min Sketch?Count-min sketch approach was proposed by Graham Cormode
7 min read
Introduction to the Probabilistic Data Structure
Introduction: Probabilistic Data Structures are data structures that provide approximate answers to queries about a large dataset, rather than exact answers. These data structures are designed to handle large amounts of data in real-time, by making trade-offs between accuracy and time and space efficiency. Some common examples of Probabilistic Data
5 min read
Sort a 2D vector diagonally using Map Data Structure
Given a 2D vector mat[][] of integers. The task is to sort the elements of the vectors diagonally from top-left to bottom-right in increasing order.Examples: Input: mat[][] = {{9, 4, 2}, {7, 4, 6}, {2, 3, 3}} Output: 3 4 2 3 4 6 2 7 9 Explanation: There are 5 diagonals in this matrix: 1. {2} - No need to sort 2. {7, 3} - Sort - {3, 7} 3. {9, 4, 3}
8 min read