/Data-structures

C++ data structures programmed for learning.

Primary LanguageC++

Data-structures

About project

Simple data structures programmed for learning.

Structures

Singly-linked list

Methods:

  • pushBack() - adds an element at the end of the list
  • pushFront() - adds an element at the beginning of the list
  • print() - prints all the values. Can be used with string parameter which will be sign(s) seperating items
  • clear() - removes all the elements
  • size() - returns number of elements
  • assign() - sets all the values as set in parameter
  • empty() - checks if the list is empty
  • find() - returns index of searched value, returns -1 if element not found
  • remove() - removes element at selected index
  • at() - accesses specified element with bounds checking
  • popFront() - removes the first element
  • popBack() - removes the last element
  • min() - returns the lowest value
  • max() - returns the biggest value
  • insert() - inserts element in specified index
  • front() - accesses the first element
  • back() - accesses the last element
  • operator[] - accesses specified element with bounds checking
  • swap() - swaps two specified elements

Double-linked list

Methods:

  • pushBack() - adds an element at the end of the list
  • pushFront() - adds an element at the beginning of the list
  • print() - prints all the values. Can be used with string parameter which will be sign(s) seperating items
  • clear() - removes all the elements
  • size() - returns number of elements
  • assign() - sets all the values as set in parameter
  • empty() - checks if the list is empty
  • find() - returns index of searched value, returns -1 if element not found
  • remove() - removes element at selected index
  • at() - accesses specified element with bounds checking
  • popFront() - removes the first element
  • popBack() - removes the last element
  • min() - returns the lowest value
  • max() - returns the biggest value
  • insert() - inserts element in specified index
  • front() - accesses the first element
  • back() - accesses the last element
  • operator[] - accesses specified element with bounds checking
  • swap() - swaps two specified elements

Stack

Methods:

  • push() - adds an element at the of the stack
  • pop() - removes the element at the top of the stack
  • peek() - accesses the element at the top of the stack
  • clear() - removes all the elements
  • size() - returns number of elements
  • empty() - checks if the stack is empty

Queue

Methods:

  • enqueue() - adds an element at the end the queue
  • dequeue() - removes the element at the begin of the queue
  • front() - accesses the element at the begin of the queue
  • back() - accesses the element at the end of the queue
  • size() - returns number of elements
  • empty() - checks if the queue is empty
  • clear() - removes all the elements
  • swap() - swaps two specified elements

Technologies

Project is created with:

  • C++
  • CMake
  • GTests