A Survey on Applications of Nonlinear Data Structures

: In this work, Non-linear data structures and their applications are discussed. Each section in this work provides insights of each non-linear data structure. The types of each non-linear data structure are described along with their applications. This paper provides knowledge about the advantages of employing non-linear data structures in real-time applications


Introduction
Data structure is the collection and organization of data items efficiently in the system's memory in order to make operations such as insertion, deletion, searching, and retrieval of data items easier.The data structure where the data elements are stored in continuous memory location (sequential order) is linear data structure.Array, Stack, Queue, and Linked List are linear data structure models.Nonlinear data structure models store data elements in random memory locations.Tree and Graph are the nonlinear data structure models.In nonlinear data structure, the data items could be connected to more than one item to show the relationship among them.All data items cannot be traversed in a single run in nonlinear data items.In this paper, the Nonlinear data structures and their application are discussed.

Tree
Tree is an abstract data type (ADT).It is a nonlinear hierarchical data structure with a root node and subtrees from the parent nodes.It is a collection of connected nodes.It is used to store simple and complex data in many applications.Tree data structure is a collection of nodes connected by edges.The tree starts with a root node (topmost node) followed by the child node.Each node is a data structure with values along with the reference values of the children.The reference value can neither be duplicated nor can point to the root node.The root node being the topmost node does not have a parent node.
The nodes traversing down from the root node are the Child nodes.The nodes from which the child node is traversed is called the Parent node.The group of nodes having the same parent is called Siblings.Fig. 1 is an example of a Tree data structure.Node A is the root node, nodes E and F are child nodes of node B, node B is the parent node of node E and F, nodes E and F are siblings because they have the same parent.

Fig 1. Tree Example
The reader should have knowledge about tree terminologies as a prerequisite.

General tree :
A tree in which each node can have either zero or many child nodes is a general tree.There is no limitation on the number of child nodes.It has many subtrees.

Application of General Tree :
The General Tree data structure is used to model the application of file systems in the OS.All the data is organized as files in the operating system.The files are further arranged into directories.These directories are systematized into a tree-like structure called the file system.[2]

Fig 2. General Tree
General trees have a few drawbacks.The problem occurs when a subtree is further added to the node with the most number of subtrees.The algorithms used for traversing, searching, adding, and deleting the nodes are more complex.To overcome these complexities, the general tree may be converted into a graph data structure, but it loses many advantages of tree data structure.Therefore, it is best to convert the general tree to a binary tree.[3]

Binary Tree :
A binary tree is a tree with nodes having a maximum of two child nodes only, i.e., each node cannot have more than two children.1. Execution of routing tables in routers.
2. Used in data compression code.

Compilation of expression parsers and expression solvers.
4. Construction of symbol table in the compiler.

5.
To check the syntax of the statement in the program while compilation using syntax tree.6. Resolving the problem of indexing in the database.
7. Evaluation of an expression using the expression tree.
8. Used when a two-way decision has to be made at each point of access.9. To find duplicates.
10. Used to represent the decision-making process (yes/no decision).Complete Binary Tree conjointly referred to as Perfect Binary Tree is a binary tree in which all levels of the tree except the last level must be completely filled.In this tree, all nodes have exactly two child nodes and all leaf nodes are at the same level.For instance, if level 2 has 4 nodes (2 2 nodes) then level 3 must have 8 nodes (2 3 nodes).Extended Binary Tree is a binary tree that can be remodeled into a full binary tree by adding special nodes called external nodes to existing nodes(internal nodes) whenever required.Each internal node in an extended tree has two child nodes and every external node is the leafnode of the tree.In an extended tree, the internal nodes are represented by circles and external nodes are represented by boxes.

Binary Search Tree (BST) :
The Binary Search Tree is also referred to as Ordered or Sorted Binary Tree.The properties of BST are : • The value of the left child of each node in the tree is less than its parent node value at each level.
• The value of the right node of each node subtree is greater than its parent node value at each level.1. Used to effectively organize data in the sorted form to make quick access to data and to search the stored data elements.
2. Used in internet routers, to store a collection of names and to find the name, based on prefix.4. To find the square root of the number.

Expression tree :
Expression Tree is used to represent mathematical expressions.The expression tree can represent boolean and algebraic expressions.This tree can represent expressions having both unary and binary operators.Fig 9 .illustrates the expression tree for the expression 3+((4*5)-(9+6)).

Application of Expression Tree:
1. To parse the expressions, i.e., to verify the syntax of the expression in the compiler and calculator.2. To represent numerical and logical expressions in programs.

AVL Tree :
AVL Tree is a height-balanced binary search tree which is named after the inventors of this data structure, G.M. Adelson, Velskey, and E.M. Landis in 1962.It is known as a height-balanced tree since each node in this tree is associated with a balance factor which is obtained by the difference between the height of its right and left subtree.AVL tree is also referred to as the self-balancing tree.[3]  1. AVL trees are used for frequent insertion.The Memory management subsystem of the Linux kernel uses the AVL tree during preemption to search memory regions of the processes.
2. AVL tree is also used to sort data that can also be used in the database.

Red-black tree :
Red-Black Tree is a binary search tree with nodes colored in red or black.The black nodes are NULL (leaf nodes) and if a node is red, then both its child nodes are black.

Splay tree :
Splay Tree, which is a self-balancing binary search tree has an additional property of quickly re-accessing the recently accessed data items.Operations such as insertion, deletion, and search are executed in O(log(n)) amortized time which makes the splay tree an efficient binary tree.The execution of operations with many nonuniform sequences, performed by the splay tree is better than other binary search trees, even when the sequence pattern is unknown.[3] Applications of Splay Tree : 1.A set of strings can be represented by the lexicographic search tree.[5] 2. Used in network routers to quickly decide on which outgoing connection, each network packet has to be sent based on the IP address.

Used to implement memory allocations and caches in data compression. It is also utilized by Windows NT
in virtual memory, networking, and filesystem.4. Intruder Detection System (IDS) being a part of security infrastructure to detect, identify and stop intruders, uses the splay tree (decision tree) data structure to increase the probability of detecting suspect threats while the risk of false positives is reduced.
5. Splay trees are also utilized in software such as GCC compiler, GNU C++ library, Unix malloc, the sed string editor, Linux loadable kernel modules, and other software.[13]

B-Tree :
B-Tree is a self-balancing tree data structure that organizes data elements in sorted order and allows operations such as insertion, deletion, searches, and sequential access in logarithmic amortized time.[8] 1. B-Tree is commonly used for indexing in database and file systems to allow quick access to data stored in disks and to improve the search operations.
2. The database uses the B-Tree data structure for secondary indexing to facilitate the select operation in range queries.[3] 3. Used to store blocks of data (secondary storage media).

B+ TREE :
The B+ tree serves as the extension of the B-tree which provides efficient and effective insertion, retrieval, and deletion operations of the data items.The difference between B-tree and B+ tree is that both keys and records(data) are stored in interior nodes in B-tree while in the B+tree, the interior nodes store only the key value and the leaf nodes store the records.The interior nodes in the B+tree are referred to as index nodes or i-nodes as they store the index values.This tree is a search tree but is different from the binary search tree.The 2-node is either a leaf node with one non-null value or has exactly 2 child nodes with values.The 3-node is either a leaf node with two values or has exactly 3 child nodes with non-null values.The 2-3 tree has all leaf nodes at the same level.[3] The 2-3 trees are efficient for inserting, searching, and deleting data elements as the tree is self-balanced.They can store and retrieve data in a nonlinear order.Trie is an efficient information retrieval data structure and hence the name "trie".This tree stores the dynamic array of strings as key values.The trie also known as Prefix Tree since it retrieves a word from the dictionary if the prefix of the word is provided.The number of pointers in each node is equal to the number of characters.For instance, if the strings stored in nodes consist of all the alphabets from 'a' to 'z', then there are 26 pointers in each node of the trie.1. Spell Checkers: Spell checking is done in three steps.Find the word in the dictionary.If the word is found, generate the potential suggestions.Finally, sort the word suggestions with the intended word on top.

AutoComplete:
The autocomplete function uses trie as this tree provides an easy search operation to find possible words from the dictionary to complete the word.The Autocomplete function is used mostly in text editors and mobile applications.

Longest Prefix Matching:
In routers, the trie is used in longest prefix matching to select the entry from the routing table for Internet Protocol (IP)networking.

Automatic Command Completion:
Used to complete the commands automatically while typing system commands in the operating system such as UNIX.

Network browser history:
Previously visited sites' URLs are recorded on the history page of the network browser.The trie organizes this history and provides the complete URL once the prefix of the previously visited URL is typed.

HEAP :
Heap is a complete binary tree data structure with two properties, structure and heap order property.Heap is a binary tree by structure and min or max heap by order.1.This tree is used when a search-heavy application performs a lot of specific range queries on a data set (e.g., sum, min, and max queries).
2. It can be used in the front end application if the needs of the application calls for it.[18] 15.Fenwick tree : The Fenwick Tree is known as the Binary Indexed Tree is used to process interval/range-based queries, compute prefix sums, and update data elements effectively.It is a multi-dimensional data structure.Fenwick tree utilizes less space when compared to the segment tree and is easy to implement.It can be used with an operation that is invertible.Fig 19 .shows each index from 1 to 8 and each node is liable to its own index and the index of the children.The Suffix Tree is a tree data structure constructed from the suffixes of a string.It is a compressed trie.
2. Finding distinct substrings in the given string.

GGM TREE :
GGM Tree is used to model a tree data structure of pseudo-random numbers in cryptographic applications.

TREAP :
Treap is the combination of both tree and heap.Each node of a treap consists of two values -key and priority.
The key is ordered according to the BST property (the left child is smaller and the right child is greater than the parent node).Priority is a random value ordered according to max-heap property.

T-TREE :
Though most databases generally use B-trees to store data on drives, some databases that store every data in memory utilizes the T-trees.
T-trees are used in main-memory databases such as ExtremeDB, Datablitz, MySQL Cluster, MobileLite, and Oracle TimesTen.

HASH TREE / MERKLE TREE:
Hash Tree is a tree data structure in which each internal node is a hash of its child node.It is used in specialized image-signatures and in p2p programs in which the hash is verified.These trees are used in :

GRAPH :
The graph is used to model nonlinear data elements.It is a nonlinear data structure that consists of a number of nodes called vertices and these vertices are connected by the edges.The graph data structure represents paired relationships between the objects.For example, graphs are used for transportation networks in which the ports, airports, intersections, etc are represented as nodes while shipping routes, airline flights, one-way roads, etc are represented by edges respectively.[3] Types of graphs : 1. Directed graph : In a directed graph, the edges from one vertex to another are directed.This graph can be a weighted or unweighted graph.In Fig. 23, A

Undirected graph :
In an undirected graph, the edges are not directed.In Fig. 24, the edges between nodes A and B forms two adjacent pairs (A,B) and (B,A), and the remaining pairs are formed similarly for the other edges.

Mixed graph :
A mixed graph is the combination of a directed and undirected graph i.e., it consists of both directed and undirected edges.

Applications of Graph :
1. Google Maps use the graph data structure as the routing system algorithm to find the shortest path between the places.The vertices are the interconnection of the roads while the edges are the roads connecting the vertices.
[21] The graph theory is now used by Apple IOS 6 maps and Bing maps.[23]

Fig 6 .
Fig 6.Left Skewed and Right Skewed Binary Tree

3 .
Used in Traveling Salesman problem, to store the path in the graph and to reverse any subsection of the path.

•
[7]  The examples are : Some sites to take data faster•Sites that use large amounts of data like Facebook.

Fig 14
Fig 14. 2-3 Tree Fig 15.Trie Fig 18. Segment Tree Tree : 1.It is used to implement the arithmetic coding algorithm.It is used to count inversions in an array in O(NlogN) time.

•
Fig 22. Hash Tree , B, C, D, and E are the vertices of the graph, connected by the edges.The adjacent pairs of vertices in the graph are (A,B), (A,D), (B,D), (C,B), (D,E), and (E,C).