KarateChopDomain 1.0.0

dotnet add package KarateChopDomain --version 1.0.0                
NuGet\Install-Package KarateChopDomain -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KarateChopDomain" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KarateChopDomain --version 1.0.0                
#r "nuget: KarateChopDomain, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install KarateChopDomain as a Cake Addin
#addin nuget:?package=KarateChopDomain&version=1.0.0

// Install KarateChopDomain as a Cake Tool
#tool nuget:?package=KarateChopDomain&version=1.0.0                

KarateChop Library

The KarateChop library provides an efficient binary search implementation for searching sorted arrays of integers.

Installation

You can install the KarateChop library via NuGet Package Manager with the following command:

Install-Package KarateChopDomain

Usage

To use the KarateChop class in your project, follow these steps:

  1. Ensure you have installed the KarateChop library via NuGet.
  2. Include the KarateChopDomain namespace in your file.
  3. Use the Chop method to perform a binary search on a sorted array of integers.

Example

using System;
using KarateChopDomain;

namespace KarateChopExample
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] sortedArray = { 1, 3, 5, 7, 9 };
            int target = 5;
            int result = KarateChop.Chop(target, sortedArray);

            if (result != -1)
            {
                Console.WriteLine($"Target found at index {result}.");
            }
            else
            {
                Console.WriteLine("Target not found in the array.");
            }
        }
    }
}

Method Details

Chop(int target, int[] array)
  • Parameters:

    • target: The integer value to search for in the array.
    • array: A sorted array of integers to search within.
  • Returns:

    • The integer index of the target value in the array, or -1 if the target is not found.

Example Scenarios

  1. Target Present in the Array:

    • For target = 5 and array = { 1, 3, 5, 7, 9 }, the method returns 2 (index of the target).
  2. Target Not Present in the Array:

    • For target = 6 and array = { 1, 3, 5, 7, 9 }, the method returns -1 (target not found).

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 85 7/11/2024