pofk_algorithm 0.0.41
pofk_algorithm: ^0.0.41 copied to clipboard
A fast, extensible Dart library for algorithms and data structures, offering search, sort, and AI utilities. Over 500 algorithms planned in future versions.
Changelog #
0.0.41 - 2025-08-10 #
The total number of algorithms is 82.
Added #
Dynamic Programming (DP) Algorithms (New)
fibonacci_memoization(Memoized Fibonacci)knapsack_01(0/1 Knapsack)longest_increasing_subsequence(LIS, O(n log n))longest_common_subsequence(LCS)edit_distance(Levenshtein Distance, DP version)matrix_path_sum(Minimum Path Sum in Grid)coin_change(Minimum Coins)subset_sum(Subset Sum DP)partition_equal_subset_sum(Equal Subset Partition)house_robber(Max Non-Adjacent Sum)jump_game(Reachability)alternating_subsequences(Longest Alternating Subsequence)rod_cutting(Max Revenue Rod Cutting)
Examples #
- Added
example/dpexample.dartwith usage demos for all new DP algorithms.
Changed #
- Exported all new DP algorithms from
lib/pofk_algorithm.dart(except duplicateedit_distance).
Added Tests & Docs #
- Full test suite for all DP algorithms in
test/dp_algorithms/. - Detailed documentation and time/space complexity for each algorithm.
Tree Algorithms (New)
binary_tree_node(generic tree node)- Tree traversals:
inorderTraversal,preorderTraversal,postorderTraversal level_order_traversal(BFS)tree_depth(height calculation)invert_tree(mirror tree)lowest_common_ancestor(LCA)validate_bst(BST validation)tree_diameter(longest path)balanced_tree_check(height-balanced check)- Tree serialization:
serialize_tree/deserialize_tree zigzag_traversal(alternating level order)
Linked List Algorithms (New)
linked_list_node(generic singly linked list node)doubly_linked_list_node(generic doubly linked list node)- Insert/delete at specific positions
- Reverse linked list (iterative, recursive, in groups, between positions)
- Cycle detection (Floyd's algorithm)
- Merge two sorted linked lists
- Remove nth node from end
- Palindrome check for linked list
- Find intersection of two lists
Detailed Tree Module #
- BinaryTreeNode — Generic binary tree node with left/right children
- Tree Traversals:
inorderTraversal<T>,preorderTraversal<T>,postorderTraversal<T> - Level Order Traversals:
levelOrderTraversal<T>,zigzagTraversal<T> - Tree Properties:
treeDepth<T>,treeDiameter<T>,isBalancedTree<T> - Tree Operations:
invertTree<T>,lowestCommonAncestor<T>,validateBST<T extends Comparable> - Serialization:
serializeTree<T>,deserializeTree<T>
Changed #
- Exported all new tree algorithms from
lib/pofk_algorithm.dart - Updated
README.mdwith comprehensive tree algorithms section - Enhanced
example/pofk_algorithm_example.dartwith basic tree operations - Added detailed tree algorithm demos in
example/tree_algorithms_example.dart
Added Tests & Docs #
- Full test suite for tree algorithms in
test/tree_algorithms/ - Detailed documentation including time/space complexity
- Generic type support (
<T>) for all algorithms, BST validation constrained toT extends Comparable
0.0.30 - 2025-08-09 #
Added #
Graph Algorithms
- BFS, DFS, Topological Sort
- Connected Components, Cycle Detection (directed/undirected)
- Bipartite Graph Check
- Shortest Path (unweighted BFS)
- Weighted Edge utility
- Dijkstra, Bellman-Ford, Floyd-Warshall
- MST: Kruskal, Prim
- Kosaraju SCC, Articulation Points
- Union-Find (alias of
DisjointSet)
Changed #
- Improved
example/pofk_algorithm_example.dartwith structured examples across all modules.
Fixed #
- Resolved compile issues in graph algorithms (generic consts, reverse usage)
- Corrected test expectations in
min_sum
0.0.2 - 2025-07-24 #
Initial Release #
List Algorithms
- Linear Search, Binary Search, Merge Sort, Bubble Sort, Insertion Sort, Selection Sort, Quick Sort, Counting Sort
- Reverse List, Find Max/Min, Find Duplicates
- Kadane's Algorithm, Max Sum Subarray of Size K, Min Sum, Average Subarray
- Two Sum (sorted), Remove Duplicates, Rotate Array Right, Prefix Sum
Set Algorithms
- Has Duplicates, Disjoint Set, Find Intersection, Set Difference, Frequency Uniqueness, Has Two Sum, Has Unique Window
Map Algorithms
- Frequency Count, Group By Key, First Non-Repeated Element, Anagram Checker, Two Sum, LRU Cache, Most Frequent Element, Top K Frequent, Length of Longest Substring
String Algorithms
- Reverse String, Palindrome Checker, Anagram Checker, Longest Palindromic Substring, String Compression
- Brute Force Search, KMP Search, Rabin-Karp Search
- Longest Common Prefix, Edit Distance, Count Vowels and Consonants