Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.77 KB

README.md

File metadata and controls

32 lines (21 loc) · 1.77 KB

Disclaimer:

Feel free to use this code if you want. Cheers :))

Description:

Advent Of Calendar Challenge 2022

  • I would like to solve some of last years challenges, and then do this years challenges as they come out.
  • I am participating in this challenge because I want to improve my skills in areas like coding, art, writing whatever each day's activity requires!
  • Have fun with the code, and feel free to use it if you want. Cheers :))

SearchTerms

The Search object provides four methods to search for an integer in an array of integers. The first two methods are linear search algorithms, one of which is optimized for performance. The last two methods are binary search algorithms, one of which is optimized for performance.

  • The linear search algorithms iterate through the array and compare each element to the search term.

  • The first algorithm returns a tuple of the found value and its index, or a string indicating that the value could not be found.

  • The second algorithm uses the find method to return a tuple of the found value and its index, or a string indicating that the value could not be found.

  • The binary search algorithms assume that the array is sorted and use a divide-and-conquer approach to find the search term.

  • The first algorithm returns a tuple of the found value and its index, or a string indicating that the value could not be found.

  • The second algorithm uses the binarySearch method to return a tuple of the found value and its index, or a string indicating that the value could not be found.

@note All methods return an Any type, which is not recommended for production code.

@note The linear_noCheatCode and binary_noCheatCode methods use mutable variables, which is not recommended for functional programming.