This ruby gem is aimed to build a library for data structures and algorithms. with learning methods, facts.
gem install ds_algo
Everything in computer is data. When you are dealing with computer, you have to understand the structure of the data. So, Data structures are funtamental part of software engineering and development.
Linked list is like chain of data. They are made of nodes, each node has a data, next_val or pre_val and next_val. There are two type of linked list
- Singly
- Doubly
require 'data_struct/linked_list'
singly = LinkedList::Singly.new
require 'data_struct/linked_list'
doubly = LinkedList::Doubly.new
First In Last Out(FILO) type data structure. One of widely used data structure.
require 'data_struct/stack'
stack = Stack.new
First In First Out(FIFO) type data structure. One of widely used data structure.
require 'data_struct/queue'
queue = Queue.new
Binary search tree (BST) is a data structure that quickly allows us to maintain a sorted list of numbers.
- It is called a binary tree because each tree node has maximum of two children.
- It is called a search tree because it can be used to search for the presence of a number in O(log(n)) time.
require 'data_struct/queue'
bst = Tree.BST
Feel free to make pull request.