Strings

AlgorithmsCollection.reverse_pure_stringFunction
reverse_pure_string(text::String)

Reverse only the non-special characters (alphabet: 'a', to 'z' and 'A' to 'Z') and letting the rest untouched. For this purpose, reverse_pure_string is scanning through the string as an array, and if the current character is not special, it will reverse the elements by swapping; vice versa, if the current character is a special element, the boundaries will be modified.

Arguments

  • text::String: String with special character like !,<#

Examples

julia> import ClassicAlgorithmsCollections
julia> string = "a!!!b.c79.d,e'f,ghi3###""
julia> ClassicAlgorithmsCollectionsreverse_pure_string(string)
"a!!!b.c79.d,e'f,ghi3###""

Array-Analysis

AlgorithmsCollection.combinations_of_2arraysFunction
combinations_of_2arrays(array_1::Array{Int64,1}, array_2::Array{Int64,1}))

Provides all combinations of sorted arrays with an increasing number of elements. Original idea

Arguments

  • array_1::Array{Int64,1}: First sorted array
  • array_2::Array{Int64,1}: Second sorted array

Examples

julia> import ClassicAlgorithmsCollections
julia> arr_1 = [10, 15, 25]
julia> arr_2 = [5, 20, 30]
julia> ClassicAlgorithmsCollections.combinations_of_2arrays(arr_1, arr_2)
[10, 20]
[10, 20, 25, 30]
[10, 30]
[15, 20]
[15, 20, 25, 30]
[15, 30]
[25, 30]
AlgorithmsCollection.count_triplet_elementsFunction
count_triplet_elements(array::Array{Int64,1}, sum::Int64)

Counting the number of three elements in the array, which sum is equal to the reference sum.

Arguments

  • array::Array{Int64,1}: Unsorted array
  • array::Array{Int64,1}: Refernece sum

Examples

```julia-repl julia> import ClassicAlgorithmsCollections julia> arr = [5, 1, 3, 4, 7] julia> sum = 12 julia> ClassicAlgorithmsCollections.counttripletelements(arr, sum) 2

Notes:


This should be implemented recursively instead of using three for-loops because it will allow using any conditions.

AlgorithmsCollection.count_pythagorean_elementsFunction
count_pythagorean_elements(array::Array{Int64,1})

Counting the number of Pythagorean-elements in the array, which sum is equal to A^2 + B^2 = C^2.

Arguments

  • array::Array{Int64,1}: Unsorted array

Examples

julia> import ClassicAlgorithmsCollections
julia> arr = [5, 1, 3, 4, 17, 8, 15, 2, 2, 13 ,12]
julia> ClassicAlgorithmsCollections.count_pythagorean_elements(arr, sum)
3
Missing docstring.

Missing docstring for find_maxlength_subarray. Check Documenter's build log for details.

AlgorithmsCollection.find_smallest_nonelementFunction
find_smallest_nonelement(array::Array{Int64,1})

Returns the smallest number of a sorted array that cannot be represented as sum of subset of elements from this array.

Arguments

  • array::Array{Int64,1}: Unsorted array

Examples

julia> import ClassicAlgorithmsCollections
julia> arr = [1, 2, 5, 10, 20, 40]
julia> ClassicAlgorithmsCollections.find_smallest_nonelement(arr)
4
Missing docstring.

Missing docstring for smallest_subset4sum. Check Documenter's build log for details.

Missing docstring.

Missing docstring for sum_of_postive_gradients. Check Documenter's build log for details.

Missing docstring.

Missing docstring for zigzag_ordering. Check Documenter's build log for details.