Data structures are ways of storing and organizing data within a computer so that you can perform actions with the stored data. Methods of storing data;
Arrays
Linked lists
Stacks
Queues
Hash table.
Arrays
Arrays are structures of a fixed size that can only hold items of the same data type like integers or chars. Arrays are indexed meaning that random access is possible.
Uses for Arrays is that they are the basis for other data structures like hash tables or matrices. Or for different sorting algorithms like quick or merge sort.
Linked lists
Linked lists are sequential structure that is comprised of a sequence of items in linear order that are linked to each other. Linked lists provide a simple and flexible representation of dynamic sets.
Elements within a linked list are called nodes and each node contains a key (data field) and a pointer (reference) to its next node. The first element is called a head where as the last element is the tail.
Linked lists can be used to implement a queue or a stack.
Stacks
Stacks are a LIFO (Last In First Out) the element placed at last can be accessed at first. Many programming languages use this.
Stacks are used in things like history in photoshop or for memory management within a computer.
Queues
Queues are FIFO (First In First Out) this means the element placed at first can be accessed at first. This structure is called a queue as it resembles a queue in real life.
Queues are used for managing threads in multithreading or for a call centre where they may need to hold a customer until another employee is free.
Hash tables
Hash tables are a data structures that store values which have keys associated with each of them. This allows for much more efficient look up if you know the proper key as key and value pairing makes it so much more easier.
Hash tables are used for implementation of database indexes and associative arrays.
Trees
Trees are hierarchical in which data is organized hierarchically and are linked together.
Many variations of trees exist like a binary search tree, B tree, treap, red-black tree, splay tree, AVL tree and n-ary tree.
Binary search trees are used for searching where data is constantly entering and leaving.
Heaps are used to store java objects
Treaps are used in wireless networking
Comments