Data Structures

  • Stack
  • Queue
  • Singly/doubly linked list
  • Hash table
  • Tree

Stack

LIFO (last in first out)

Basic Operations

  • Push: Add an element to the top of a stack
  • Pop: Remove an element from the top of a stack
  • IsEmpty: Check if the stack is empty
  • IsFull: Check if the stack is full
  • Peek: Get the value of the top element without removing it

Queue

FIFO (first in first out)

Basic Operations

  • Enqueue (push): Add an element to the end of the queue
  • Dequeue (pop): Remove an element from the front of the queue
  • IsEmpty: Check if the queue is empty
  • IsFull: Check if the queue is full
  • Peek: Get the value of the front of the queue without removing it

Linked List

NODE

class Node {
  constructor(data) {
    this.data = data
    this.next = null
  }
}

Basic Operations

  • traverse: Print the content of linked list

     
  • add: Adds an item to the end of the list.
  • addAfter: Adds an item after the element.
  • isExist: Try to find the element in list.
  • delete: Remove element from list.

Types of Linked List

Singly Linked List

Doubly Linked List

Circular Linked List

Array

Hash Table

h(k) - hash function

k - key of data

Collision

Text

Linked List

Basic Operations

  • insertData: Insert element to table.
  • getData: Get element from table.
  • removeData: Remove element by key.

Tree

  • Node is an entity that contains a key or/and value and pointers(links) to its child nodes.
  • Edge (ребро) is the link between any two nodes.

Types of tree

  • Binary Tree
  • Binary Search Tree
  • AVL Tree
  • B-Tree
  • ...more

Binary tree

Made with Slides.com