Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Data Structures

Data Structures

  • Identifiez-vous pour voir les commentaires

  • Soyez le premier à aimer ceci

Data Structures

  1. 1. Data Structures
  2. 2. Content 1. Data Structure 2. Linear Data Structure 3. Array 4. Linked List 5. Stack 6. Queue 7. Non-Linear Data Structure 8. Tree 9. Graph
  3. 3. Data Structure A way of organizing data in computer memory so it that can be used effectively. The idea is to reduce time and space complexities of different operations. Data Structure Hierarchy
  4. 4. Linear Data Structure List of Linear Data Structures Array Array is data structure used to store homogeneous elements at the contiguous locations Linked List A linked list is sequence of elements and each element is separate object consist of 2 items data and reference to next node. Stack A stack is an abstract data type with principle of LIFO (last in , first out). Queue A queue is another ADS with principle of FIFO (first in, first out).
  5. 5. Arrays Array is collection of items stored at a contiguous locations. The idea is to store multiple items of same type together. List of Basic Operations on Array Insertion O(n) Adding an element at give index. Deletion O(n) Remove the element at given index. Search O(n) or Sorted Array O(log n) Searches an element using given value. Traverse O(n) Fetch each element one by one. Access O(1) Get an element value of at given index.
  6. 6. Linked List Linked List is a sequence of nodes which contains items. Each node contains data and link to next node. Types of Linked List Simple Linked List Every node in list store next node link and last node has NULL as link. Doubly Linked List Every node in list has 2 links one to the next node and other to the previous node. Circular Linked List It is similar to simple linked list, except last node link reference to first node.
  7. 7. Linked List (cont.) List of Basic Operations on Linked List Insertion O(1) New Node can added as first, or at after current reference or as last Node. Deletion O(1) Existing Node can deleted as first, or after current reference or as last Node. Search O(n) Searches an element using given value. Access O(n) To get an element has to traverse from head node. Head => 1 => 3 => NULL Head => 0 => 1 => 3 => NULL Head => 0 => 1 => 2 => 3 => NULL Head => 0 => 1 => 2 => 3 => 4 => NULL Head => A => B => C => D => E => NULL Head => B => C => D => E => NULL Head => B => D => E => NULL Head => B => D => NULL
  8. 8. Stack A Stack is Abstract Data Type (ADT) like real-world stack allows operations at one end only or it is called as Last-In-First-Out (LIFO). List of Basic Operations on Stack Push O(1) Adding an element at top of the stack. Pop O(1) Remove the element from top of the stack. Access O(n) Element can be access using top pointer.
  9. 9. Queue A Queue is Abstract Data Type (ADT) like real-world queue allows operations at two end or it is called as First-In-First-Out (FIFO). List of Basic Operations on Queue Enqueue O(1) Adding an element at rear or end of the queue. Dequeue O(1) Remove the element from front of the queue. Access O(n) An element can be access in queue using front or rear pointer.
  10. 10. Non-Linear Data Structure It is a data structure in which a data element is connected to several other data elements. List of Non-Linear Data Structures Tree It is a hierarchical data structure Graph It is pervasive data structure
  11. 11. Tree Type of Trees data structure Binary Tree It is a tree in which each node has at most 2 children Binary Search Tree It is similar to BT, but left child always less than parent and right is always greater than parent Red Black Tree It is self-balancing BST where each node has an extra bit to represent color. AVL Tree It is self-balancing BST where height of left and right subtrees cannot be more than one. Binary Heap It is complete tree, with heap ordering property i.e. Root node value is either Max or Min of its children. Tree is a Abstract Data type (ADT), that simulates a hierarchical tree structure with root value and subtrees of children with a parent node, represented as a set of linked node.
  12. 12. Binary Search Tree (BST) BST, is a tree in which each node has at most 2 children and left child node key always less than parent node and right child key is always greater than parent node List of Basic Operations on BST 1. Insertion O(h*) Adding an element in tree. 2. Deletion O(h*) Remove the element from tree. 3. Search O(h*) Search an element in a tree. Traversal Order 1. Pre-order : Root => Left => Right 2. In-order : Left => Root => Right 3. Post-order : Left => Right => Root 4. Level-order: Level 0 => Level 1 => …Level n * Height of the tree
  13. 13. Graph A Graph is a non-linear data structure group of vertices and edges, where edges are used to connect vertices. It can be seen as a cyclic tree, where the vertices(Node) maintain complex relationship among them instead of having parent child relationship.
  14. 14. Graph (cont.) 1. Undirected Graph (a) An undirected graph G having five vertices and seven edges. (b) An adjacency-list representation of G. (c) The adjacency-matrix representationof G. 2. Directed Graph (a) A directed graph G having six vertices and eight edges. (b) An adjacency-list representation of G. (c) The adjacency-matrix representation of G.
  15. 15. Graph (cont.) Depth First Search (DFS) Breadth First Search (BFS) Graph Traversal
  16. 16. Questions?

×