Skip to content

Python Library makes it easy for users to code and run data structures & algorithms without having to summarize everything.

License

Notifications You must be signed in to change notification settings

fazil2003/easydsi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easyDSI 1.2.1



Python Library makes it easy for users to code and run data structures & algorithms without having to summarize everything.

Contains

  • heap()
    • min_heap()
    • max_heap()
  • queue()
  • tree()
    • binary_tree()
    • binary_search_tree()

Heap

  • heap() or heap([list]) - Creates a min heap.
  • min_heap() or min_heap([list]) - Creates a min heap.
  • max_heap() or max_heap([list]) - Creates a max heap.

Methods

  • add(element) - Add the element at the last position.
  • remove() - Delete the element.
  • get_max(n) - Get the n maximum elements from the heap.
  • get_min(n) - Get the n minimum elements from the heap.
  • display() - Display all the elements.
  • get_elements() - Return all the elements.

Queue

  • queue() or queue([list]) - Creates a queue.

Methods

  • add(element) - Add the element at the last position.
  • add(position, element) - Add the element at the position you give.
  • add_first() - Add the element at the first position.
  • add_last() - Add the element at the last position.
  • remove() - Delete the element from the first position.
  • remove(position) - Delete the element from the position.
  • remove_first() - Remove the element from the first position.
  • remove_last() - Remove the element from the last position.
  • index(position) - Get the element from the position.
  • find(element) - Get the index of the element.
  • display() - Display all the elements.
  • get_elements() - Return all the elements.
  • get_size() - Get the total number of elements.
  • get_max() - Get the maximum element from the queue.
  • get_min() - Get the minimum element from the queue.
  • get_sum() - Get the sum of the elements from the queue.
  • get_avg() - Get the average of the elements from the queue.
  • reverse(inplace=False) - Reverse the queue.
  • sort(desc=False, inplace=False) - Sort the queue.
  • map(function, inplace=False) - Map all the elements to the function.

Tree

  • tree() or tree([list]) - Creates a binary tree.
  • binary_tree() or binary_tree([list]) - Creates a binary tree.
  • binary_search_tree() or binary_search_tree([list]) - Creates a binary search tree.

Methods

  • add(element) - Add the element.
  • remove(value) - Delete the element with the value.
  • get_elements() - Return all the elements.
  • get_nodes() - Return all the nodes.
  • display() - Display all the elements.
  • inorder() - Return the in-order traversal of the tree.
  • preorder() - Return the pre-order traversal of the tree.
  • postorder() - Return the post-order traversal of the tree.
  • levelorder() - Return the level-order traversal of the tree.
  • get_size() - Get the total number of elements.
  • get_height() - Return the height of the tree.
  • get_properties() - Return the properties of the tree.

How to install

  • Open your command prompt and enter the below command.
pip install easydsi

How to use

  • Import the library in your project.
import easydsi as dsi
  • Initialize the data structure.
queue = dsi.queue([1, 2, 3])
queue.display()

[1, 2, 3]

  • Add an element.
queue.add(4)
queue.display()

[1, 2, 3, 4]

  • Remove an element.
queue.remove()
queue.display()

[1, 2, 3]


Hits

About

Python Library makes it easy for users to code and run data structures & algorithms without having to summarize everything.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages