Implementation of data structures and algorithms in Dart programming language.

Overview

Algorithms in Dart

Build Status

Implementation of several algorithms with Dart programming language.

Use dartdoc to generate documentation.

Lists

List data structures are implemented under the package lists.

SinglyLinkedList

lib/lists/singly_linked_list.dart

DoublyLinkedList

lib/lists/doubly_linked_list.dart

CircularLinkedList

lib/lists/circular_singly_linked_list.dart and lib/lists/circular_doubly_linked_list.dart

Stack

lib/lists/stack.dart

Queue

lib/lists/queue.dart

Heaps

BinaryHeap

All base classes are in lib/heaps/base.dart

lib/heaps/binary_heap.dart - BinaryHeap, MinHeap and MaxHeap

Sorts

lib/sorts/common.dart contains helper functions and typedefs for sorting algorithms.

lib/sorts/exchange.dart - Bubble Sort, Odd-Even Sort, Gnome Sort, Quick Sort

lib/sorts/insertion.dart - Insertion Sort

lib/sorts/selection.dart - Heap Sort, Selection Sort

lib/sorts/distribution.dart - Pigeonhole Sort, Counting Sort, Radix Sort

lib/sorts/merge.dart - Merge Sort

Searching

lib/search/sequential.dart - Linear Search

lib/search/interval.dart - Binary Search

Trees

Binary Search Tree

lib/trees/binary_search_tree.dart

AVL Tree

lib/trees/avl_tree.dart

Red Black Tree

lib/trees/red_black_tree.dart

Math

lib/math/common.dart - GCD, LCM, Factorial

Graph

ADT

lib/graph/graph.dart - Graph ADT

lib/graph/vertex.dart - Vertex

lib/graph/traversal.dart - Traversal ADT to represent graph traversal results.

Traversals

lib/graph/dfs.dart - Algorithm for DFS traversal on graphs.

lib/graph/bfs.dart - Algorithm for BFS traversal on graphs.

Graph Paths

lib/graph/topological_sort.dart - Topological sort on acyclic digraphs.

lib/graph/bellman_ford.dart - Bellman Ford Algorithm

lib/graph/dijkstra.dart - Dijkstra's algorithm

Comments
  • Radix Sort

    Radix Sort

    I am watching dsa js tutorial and implementing in on dart currently on radix sort

    //radix sort import 'dart:math' as Math;

    main() { }

    getDigitNum(int n, int i) { // return ((n / 100).round() %10); // var cal = (n.abs() / Math.pow(10, =i)) % 10; var cal = (n.round().abs() / Math.pow(10, i)) % 10; // var cal = (n / 100)%10;

    return cal.round(); }

    digitCount(int number) { if (number == 0) { return 1; } return (number.abs().toString().length); }

    mostDigits(List number) { var maxDigits = 0; for (var i = 0; i < number.length; i++) { maxDigits = Math.max(maxDigits, digitCount(number[i])); } return maxDigits; }

    radixSort(List nums) { var maxDightCount = mostDigits(nums); for (var k = 0; k < maxDightCount; k++) { List digitBuckets = List.from({});//confused here } }

    //here is the js codefunction getDigit(num, i) { return Math.floor(Math.abs(num) / Math.pow(10, i)) % 10; }

    function digitCount(num) { if (num === 0) return 1; return Math.floor(Math.log10(Math.abs(num))) + 1; }

    function mostDigits(nums) { let maxDigits = 0; for (let i = 0; i < nums.length; i++) { maxDigits = Math.max(maxDigits, digitCount(nums[i])); } return maxDigits; }

    function radixSort(nums){ let maxDigitCount = mostDigits(nums); for(let k = 0; k < maxDigitCount; k++){ let digitBuckets = Array.from({length: 10}, () => []); for(let i = 0; i < nums.length; i++){ let digit = getDigit(nums[i],k); digitBuckets[digit].push(nums[i]); } nums = [].concat(...digitBuckets); } return nums; }

    radixSort([23,345,5467,12,2345,9852])

    //i just want help this part below js code

    let digitBuckets = Array.from({length: 10}, () => []);
    

    //dart code List digitBuckets = List.from({});//confused here

    opened by vipuluthaiah 4
  • Implement Sorted Linked List.

    Implement Sorted Linked List.

    This will be similar to SinglyLinkedList. The differences would be:

    • fromList() constructor will sort the elements of the list before inserting them.

    • append() won't be implemented.

    • insert() will not take position as parameter, since we'll decide where the newNode goes.

    enhancement good first issue 
    opened by happy-san 3
  • Convert tree algorithms to not nullable

    Convert tree algorithms to not nullable

    Some ground-works have been done to make the process easier such as tighter generics types (Please look into the ADTs and nil on RedBlackTree). The process should start with removal of // @dart=2.9 on the files (module + test) and start addressing the errors by adding punctuations. The pattern for converting tests is to first append a ? on the pre-setUp variables and then append ! to all test cases (to ensure the value isn't null and are initialized, which is ensured since setUp initializes them any way). Only files that are NNBDed are tree_adt.dart and binary_tree_adt.dart.

    enhancement 
    opened by code-shoily 0
  • Refactor Vertex Tests

    Refactor Vertex Tests

    The test/graph/vertex_test.dart has variables bleeding throughout the codebase. We need to clean those up in spirit of other files. We should extract all local var declarations in the top level and lock/unlock them on setUp. Also, we can add lockAll, unlockAll, _initializeVertex etc functions to keep setUp uncluttered. We can test/graph/graph_test.dart for inspiration.

    good first issue refactor 
    opened by code-shoily 0
  • Refactor Graph ADT

    Refactor Graph ADT

    • Add inComing and outGoing fields on Vertex to include connections
    • Remove Connection and replace it with LinkedHashMap with num as values (weight)
    • Refactor Graph as abstract class
    • Remove Settings
    enhancement refactor 
    opened by code-shoily 0
  • Implement Tree data structures.

    Implement Tree data structures.

    Goals:

    • [X] Binary Search Tree.

    • [x] AVL Tree.

    • [X] Red-Black Tree.

    • [ ] B Tree.

    • [ ] B+ Tree.

    • [x] Threaded Binary Tree.

    • [x] Trie.

    • [ ] Radix Tree.

    enhancement good first issue 
    opened by happy-san 2
Owner
Mafinar Khan
python • elixir • dart
Mafinar Khan
Docker images for the Dart programming language (https://dart.dev)

dart-docker This is the Git repo of the Docker "Official Images" for the Dart programming language. See the Docker Hub page for a full description on

Dart 49 Dec 14, 2022
Intel Corporation 238 Dec 24, 2022
This repository was created to provide the basics of the Dart programming language and Its use cases.

dart-exercises A collection of source code of the Dart Programming language. How does this repository works? Clone / Fork this repository to make your

Technosoft Labs 2 Oct 28, 2021
🇮🇪 A generic programming language interpreter, linter, formatter, and all that jazz, written in Dart.

Irishman ???? A generic programming language interpreter, linter, formatter, and all that jazz, written in Dart. Installation To install this package

Fairfield Programming Association 2 Oct 8, 2022
Repo for Teach Yourself mastering dart programming language

mastering-dart Repo for Teach Yourself mastering dart programming language Chapter Membuat Aplikasi Pertama Menggunakan Dart Percabangan Perulangan Fu

Feri Lukmansyah 50 Nov 10, 2022
App concept created with Flutter using Dart programming language, inspired by Groceries Shopping App Interaction.

Grocery Shop Flutter App concept created with Flutter using Dart programming language, inspired by Groceries Shopping App Interaction. About The app w

Wilton Neto 485 Dec 9, 2022
The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion.

Fluid Slider Flutter The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion. About The component was

Wilton Neto 41 Sep 30, 2022
Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Rab Bar.

Gooey Tab Bar Flutter Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Tab Bar. About This component

Wilton Neto 216 Dec 14, 2022
Fan-made, handmade, recursive-descent parser for the Dart programming language.

Very Unofficial Parser Fan-made, handmade, recursive-descent parser for the Dart programming language. Although this parser strives to parse the langu

Joanna May 64 Nov 21, 2022
Experimenting with 6 examples of different types of simple and complex JSON structures in Flutter

Parsing complex JSON in Flutter Gives a detailed explanation of working with simple and complex JSON structures using dart:convert library in Flutter

Pooja Bhaumik 488 Jan 6, 2023
A showcase app for the Flutter SDK. Wonderous will educate and entertain as you uncover information about some of the most famous structures in the world.

Wonderous Navigate the intersection of history, art, and culture. Wonderous will educate and entertain as you uncover information about some of the mo

gskinner team 2.3k Dec 29, 2022
Flutter language pickers2 - Language pickers package for Dart and Flutter

language_pickers2 Notes: Original repository from github.com/gomgom, unfortunate

Charles Dyason 0 Feb 6, 2022
FIDL(Flutter Interface Definition Language) is a language for transfer objects cross platforms.

Flutter Interface Definition Language (FIDL) README in English(TODO) FIDL 即 Flutter 接口定义语言,类似于AIDL(Android Interface Definition Language)。您可以利用它定义不同平台

null 47 Dec 7, 2022
null 1 Jan 8, 2022
Data Migrator - provide a universal translator for data by being portable, diverse, and efficient in migrating and converting data across discrete schemas

Data Migrator - provide a universal translator for data by being portable, diverse, and efficient in migrating and converting data across discrete schemas

Tanner Meade 77 Jan 2, 2023
A collection of useful algorithms in Dart with keeping performance and flexibility on mind.

algorithmic A collection of useful algorithms in Dart with keeping performance and flexibility on mind. Usage The following import will give you acces

Sudipto Chandra 7 Jan 1, 2023
The Dart language implementation of gRPC.

The Dart implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. Learn more Quick Start - ge

grpc 737 Jan 6, 2023
Lite-graphql - A light way implementation of GraphQL client in dart language

lite GraphQL client A light way implementation of GraphQL client in dart languag

Vincenzo Palazzo 3 Mar 17, 2022
A repo for me to test and collate popular algorithms.

Common Algorithms written in Dart This repo is a result of practicing the algorithms presented on www.geeksforgeeks.org, as well as some coding challe

Gerard R 1 May 28, 2022