{"id":19062500,"url":"https://github.com/armcburney/ruby-ds","last_synced_at":"2026-06-19T02:31:31.114Z","repository":{"id":118502261,"uuid":"60313459","full_name":"armcburney/ruby-ds","owner":"armcburney","description":":bulb: Data structures and algorithms written in idiomatic Ruby","archived":false,"fork":false,"pushed_at":"2018-12-12T17:39:31.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T02:26:34.734Z","etag":null,"topics":["algorithms","ruby","spacial-complexity","time-complexity"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/armcburney.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-03T02:51:00.000Z","updated_at":"2018-12-12T17:39:33.000Z","dependencies_parsed_at":"2023-11-06T06:15:10.984Z","dependency_job_id":null,"html_url":"https://github.com/armcburney/ruby-ds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/armcburney/ruby-ds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcburney%2Fruby-ds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcburney%2Fruby-ds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcburney%2Fruby-ds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcburney%2Fruby-ds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/armcburney","download_url":"https://codeload.github.com/armcburney/ruby-ds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcburney%2Fruby-ds/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34515405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","ruby","spacial-complexity","time-complexity"],"created_at":"2024-11-09T00:26:18.945Z","updated_at":"2026-06-19T02:31:31.098Z","avatar_url":"https://github.com/armcburney.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"* =armcburney/ruby-ds=\nCommon algorithms and data structures written in Ruby.\n\n** Purpose\nThis repository provides the implementation of various algorithms in Ruby. The\npurpose of this repository is to re-acquaint myself with various algorithms used\nin computer science, as well as their spacial and time complexities.\n\n** Data Structures\n*** Binary Tree\n**** =insert=\n#+BEGIN_SRC\nRecursively inserts a new node into the tree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n@param [Algorithms::Node] curr\n#+END_SRC\n\n**** =delete=\n#+BEGIN_SRC\nRecursively deletes a node if it exists in the tree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n#+END_SRC\n\n**** =find_node=\n#+BEGIN_SRC\nFinds and returns a node with the value in a subtree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Integer] val\n@param [Algorithms::Node] node\n@return [Algorithms::Node]\n#+END_SRC\n\n**** =height=\n#+BEGIN_SRC\nReturns the height of the tree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n@param [Integer] h\n@return [Integer]\n#+END_SRC\n\n**** =find_min=\n#+BEGIN_SRC\nFinds and returns the minimum element in a subtree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n@return [Algorithms::Node]\n#+END_SRC\n\n**** =find_max=\n#+BEGIN_SRC\nFinds and returns the maximum element in a subtree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n@return [Algorithms::Node]\n#+END_SRC\n\n**** =next_highest_node=\n#+BEGIN_SRC\nFinds and returns the next highest node in a subtree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n@return [Algorithms::Node]\n#+END_SRC\n\n**** =count_nodes=\n#+BEGIN_SRC\nReturns the number of nodes beneath a given node.\n\nTime complexity:\n  O(n) worst case\n  O(n) average case\n\n@param [Algorithms::Node] node\n@return [Integer]\n#+END_SRC\n\n**** =exists?=\n#+BEGIN_SRC\nReturns `true` if the value exists in the binary subtree.\n\nTime complexity:\n  O(n) worst case\n  O(log(n)) average case\n\n@param [Algorithms::Node] node\n#+END_SRC\n\n**** =valid?=\n#+BEGIN_SRC\nReturns `true` if the binary subtree is valid.\n\nTime complexity:\n  O(n) worst case\n  O(n) average case\n\n@param [Algorithms::Node] node\n@return [Boolean]\n#+END_SRC\n\n**** =pre_order_traversal=\n#+BEGIN_SRC\nPrints the tree node values pre-order.\n\nTime complexity:\n  O(n) worst case\n  O(n) average case\n\n@param [Algorithms::Node] node\n#+END_SRC\n\n**** =in_order_traversal=\n#+BEGIN_SRC\nPrints the tree node values in-order.\n\nTime complexity:\n  O(n) worst case\n  O(n) average case\n\n@param [Algorithms::Node] node\n#+END_SRC\n\n**** =post_order_traversal=\n#+BEGIN_SRC\nPrints the tree node values post-order.\n\nTime complexity:\n  O(n) worst case\n  O(n) average case\n\n@param [Algorithms::Node] node\n#+END_SRC\n\n*** Min Heap\n**** =insert=\n#+BEGIN_SRC\nInserts an element into the heap.\n\nTime complexity:\n  O(log(n)) worst case\n  O(log(n)) best case\n\n@param [Integer] val\n#+END_SRC\n\n**** =delete_min=\n#+BEGIN_SRC\nDeletes the minimum element from the heap.\n\nTime complexity:\n  O(log(n)) worst case\n  O(log(n)) best case\n\n@return [Integer]\n#+END_SRC\n\n**** =min=\n#+BEGIN_SRC\nReturns the minimum element of the heap.\n\nTime complexity:\n  O(1) worst case\n  O(1) best case\n\n@return [Integer]\n#+END_SRC\n\n**** =size=\n#+BEGIN_SRC\nReturns the size of the heap.\n\nTime complexity:\n  O(1) worst case\n  O(1) best case\n\n@return [Integer]\n#+END_SRC\n\n**** =height=\n#+BEGIN_SRC\nReturns the height of the heap.\n\nTime complexity:\n  O(1) worst case\n  O(1) best case\n\n@return [Integer]\n#+END_SRC\n\n**** =empty?=\n#+BEGIN_SRC\nReturns `true` if the heap is empty.\n\nTime complexity:\n  O(1) worst case\n  O(1) best case\n\n@return [Boolean]\n#+END_SRC\n\n**** =self.decreasing_order_sort=\n#+BEGIN_SRC\nSorts an array using heap sort, in decreasing order.\n\nTime complexity:\n  O(n * log(n)) worst case\n  O(n * log(n)) average case\n  O(n) best case\n\n@param  [Array[Integer]] arr\n@return [Array[Integer]]\n#+END_SRC\n\n*** Max Heap\n**** =insert=\n**** =delete_max=\n**** =max=\n**** =size=\n**** =height=\n**** =empty?=\n**** =self.increasing_order_sort=\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmcburney%2Fruby-ds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmcburney%2Fruby-ds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmcburney%2Fruby-ds/lists"}