Algorithms and Data Structures in Ruby
This repository contains Ruby implementation of various Algorithms and Data structures
Content :
How?
Simply run ruby some_file.rb
to execute the algorithm. At the bottom of each file there are some test samples.
example: ruby longest_consecutive_subsequence.rb
will print:
4
.
Contribute
Did you find a bug? any way to do it better? please feel free to pull-request it :)
algorithms_ruby
- arrays
- 2_number_sum_without_hash.rb
- 3_number_sum.rb
- 4_number_sum.rb
- array_of_products_except_self.rb
- common_elements_3_sorted_arrays.rb
- delete_duplicates_sorted_array.rb
- find_dublicates_in_array.rb
- first_duplicate_n_array.rb
- first_non_repeating_char.rb
- first_repeating_element.rb
- getMissing1to100Xor.rb
- is_monotonic.rb
- is_subsequence.rb
- largest_continous_subarray.rb
- largest_product_subarray.rb
- longest_mountain.rb
- merge_overlapping_intervals.rb
- min_number_off_platforms.rb
- min_sorted_rotated_array.rb
- missingNumber1to100.rb
- move_zeros_to_end.rb
- pair_whose_sum_equals_number.rb
- smallest_difference.rb
- smallest_non_constructible_change.rb
- square_of_sorted_arrays.rb
- tournament_winner.rb
- union_sorted_arrays.rb
- bit_manipulation
- bst
- bst.rb
- dp
- 01_knapsack.rb
- coin_change.rb
- edit_distance.rb
- fibonacci.rb
- job_scheduling_max_profit.rb
- max_sum_non_adjacent.rb
- ways_to_make_coin_change.rb
- graph
- dfs.rb
- graph.rb
- greedy
- fractional_knapsack.rb
- huffman_coding.rb
- job_sequencing_max_profit.rb
- max_meetings_in_a_room.rb
- minimum_number_of_coins.rb
- water_connection_problem.rb
- heap
- build_heap_from_array.rb
- heap.rb
- heap_sort.rb
- kth_largest_element.rb
- merge_k_sorted_arrays.rb
- sliding_window_max_from_array.rb
- linkedlist
- detect_cycle_floyds_mathemetical.rb
- detect_cycle_hashing.rb
- detect_cycle_one_by_one.rb
- has_cycle.rb
- intersection_point_2_pointers.rb
- intersection_point_hashmap.rb
- intersection_point_using_node_counts.rb
- linklist.rb
- merge_sort_ll.rb
- middle_of_linkedlist.rb
- node.rb
- nth_node_from_end.rb
- nth_node_from_end_single_pass.rb
- reverse_in_group_iterative.rb
- reverse_in_groups.rb
- reverse_linklist.rb
- rotate_right.rb
- matrix
- diagonal_traversal_matrix.rb
- spiral_traversal_matrix.rb
- others
- rail_fence.rb
- practice
- merge_sort.rb
- searching
- binary_search.rb
- sorting
- bubble_sort.rb
- merge_sort.rb
- quick_sort.rb
- strings
- Manachers_algo.rb
- anagram_string.rb
- duplicates_in_str.rb
- interleaving_string.rb
- is_palindrome.rb
- longest_consecutive_subsequence.rb
- longest_palindromic_substring.rb
- string_is_rotation_of_other.rb
- subsequences_string.rb
- trees
- convert_to_mirror_of_tree.rb
- dfs.rb
- diameter_of_tree.rb
- height.rb
- height_of_tree.rb
- in_order_traversal.rb
- inorder_Morris_algo.rb
- left_view_bt.rb
- lever_order_traversal_tree.rb
- mirror_of_tree.rb
- postorder_traversal.rb
- preorder_traversal.rb
- reverse_level_order.rb
- right_view_bt.rb
- tree_generator.rb
- tree_node.rb