bisect

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"

	"github.com/paralus/prompt/pkg/prompt/internal/bisect"
)

func main() {
	in := []int{1, 2, 3, 3, 3, 6, 7}
	fmt.Println("Insertion position for 0 in the slice is", bisect.Right(in, 0))
	fmt.Println("Insertion position for 4 in the slice is", bisect.Right(in, 4))

}
Output:

Insertion position for 0 in the slice is 0
Insertion position for 4 in the slice is 5

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Right(a []int, v int) int

Right to locate the insertion point for v in a to maintain sorted order.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL