Theory

 DATA STRUCTURES IN C (DSC)
A data structure is a particular way of organizing data in a computer so that it can be used efficiently. General data structure types include the array, the file, the record, the table, the tree, and so on. Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, databases use Binary tree indexes for small percentages of data retrieval and databases use hash tables for security purpose.
Abstract data types
•        Singly linked list
•        Doubly linked list
•        Stack (LIFO)
•        Queue (FIFO)
•        Double-ended queue
•        Priority queue
•        Tree
•        Binary Heap




LIFO – Last in first out

 The push and pop operations occur only at one end of the structure, referred to as the top of the stack. (Additionally, a peek operation may give access to the top.)

A stack may be implemented to have a bounded capacity. If the stack is full and does not contain enough space to accept an entity to be pushed, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack. A pop either reveals previously concealed items or results in an empty stack, but, if the stack is empty, it goes into underflow state, which means no items are present in stack to be removed.



FIFO - First-In-First-Out


 In this type of data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. It is an example of a linear data structure




Linked list is a data structure consisting of a group of nodes which together present a sequence. Under the simplest form, each node is composed of data and a reference (in other words, a link) to the next node in the sequence; more complex variants add additional links. This structure allows for efficient insertion or removal of elements from any position in the sequence.




A binary tree is made of nodes, where each node contains a "left" reference, a "right" reference, and a data element. The topmost node in the tree is called the root. Every node (excluding a root) in a tree is connected by a directed edge from exactly one other node. This node is called a parent. On the other hand, each node can be connected to arbitrary number of nodes, called children. Nodes with the same parent are called siblings. A full binary tree.is a binary tree in which each node has exactly zero or two children.




No comments:

Post a Comment