
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Calculates algorithms and data structures for sorting and searching. Selects best one to use for particular data set.
Additionally, data structures can be used for own purposes. All data structures have the ability to insert and search. Will add deletion in the future.
Written by Joseph Bui.
"sort"
)
"bubble_sort"
)"insertion_sort"
)"selection_sort"
)"merge_sort"
)"quick_sort"
)"heap_sort"
)"search"
)
"stack"
)"queue"
)"linked_list"
)"binary_tree"
)action
is the string of the action, can be "sort"
or "search"
data_set
has to be in array formattrials
is number of test trials (optional, default = 1)target
is element user wants to search (unnecessary for sort
, default = null)algorithm
is the string of the algorithm or data structureall(action, data_set, trials, target)
AlgorithmSelector.all("sort", [2,1,4,3], 1000)
AlgorithmSelector.all("search", [2,1,4,3], 1000, 4)
best(action, data_set, trials, target)
AlgorithmSelector.best("sort", [2,1,4,3], 1000)
AlgorithmSelector.best("search", [2,1,4,3], 1000, 4)
analyze(action, data_set, algorithm, trials, target)
AlgorithmSelector.analyze("sort", [2,1,4,3], "merge_sort", 1000)
AlgorithmSelector.analyze("search", [2,1,4,3], "linked_list", 1000, 4)
compare(action, data_set, first_algorithm, second_algorithm, trials, target)
AlgorithmSelector.compare("sort", [2,1,4,3], "merge_sort", "quick_sort", 1000)
AlgorithmSelector.compare("search", [2,1,4,3], "stack", "linked_list", 1000, 4)
sort(data_set, algorithm)
AlgorithmSelector.sort([2,1,4,3], "bubble_sort")
size = 10
stack = Stack.new(size)
# returns nil
value = 6
stack.push(value)
# returns true if found, else returns false
target = 4
stack.search(target)
size = 10
queue = Queue.new(size)
# returns nil
value = 6
queue.enqueue(value)
# returns true if found, else returns false
target = 4
queue.search(target)
linked_list = LinkedList.new
# returns nil
value = 6
linked_list.insert(value)
# returns true if found, else returns false
target = 4
linked_list.search(target)
binary_tree = BinaryTree.new
# returns nil
value = 6
binary_tree.insert(value)
# returns true if found, else returns false
target = 4
binary_tree.search(target)
Add this line to your application's Gemfile:
gem 'algorithm_selector'
And then execute:
$ bundle
Or install it yourself as:
$ gem install algorithm_selector
Require the Gem:
$ require 'algorithm_selector'
Bug reports and pull requests are welcome on GitHub at https://github.com/jnvbui/algorithm_selector. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that algorithm_selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.