Data Structures and Algorithms with Ballerina

Tharindu Udupitiya
Ballerina Swan Lake Tech Blog
2 min readMay 13, 2023
Clément Hélardot on Unsplash

This article focuses on some implementations regarding Data Structures and Algorithms using Ballerina.

If you are new to Ballerina, please visit ballerina.io for more information on the language and get started. You can install Ballerina by following this guide.

The code samples related to this article can be found in this repository.

Each of the data structures is implemented as a Ballerina project (to learn more about Ballerina and its package structure, follow this link) in the src directory of the repo. Following is the project structure of the above repo, along with the methods discussed.

--DSA-with-Ballerina
--src
--graph
--adjListGraph
--adjMatrixGraph
--hashing
--hashing
--heap
--heap
--list
--circularLinkedList
--doublyLinkedList
--singlyLinkedList
--matrix
--sortedMatrix
--spiralMatrix
--queue
--queue
--search
--binarySearch
--linearSearch
--sorting
--bubbleSort
--insertionSort
--mergeSort
--selectionSort
--quickSort
--tree
--binarySearchTree
--binaryTree

Running the projects

  • First, you can clone this project to your local machine using the command

git clone https://github.com/udda1996/DSA-with-Ballerina.git

  • To run each of these projects, you have to navigate to the directory related to that project in the cloned repo using your terminal and perform the bal run command. Then the project will compile and run, and you will see the outputs of the examples in your terminal.

Understanding the contents

Each of the projects contains a README.md file which contains a simple and comprehensive explanation of each of the data structures and algorithms which have been implemented in the Ballerina project.

Become a contributor!!

Thank you for your interest in our project! We welcome and encourage contributions from the community. By contributing to this project, you can gain valuable experience in the Ballerina language and enhance your programming skills.

As a contributor, you can add your own content and ideas to the project by creating a pull request with your content. You can also help us improve the project by reporting bugs or suggesting improvements through issues.

We value your input and look forward to working together to make this project better. Thank you for considering this opportunity to grow and learn with us!

--

--

Tharindu Udupitiya
Ballerina Swan Lake Tech Blog

Software Engineer at WSO2 LLC | B.Sc. Electronic and Telecommunication Engineering