Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

github.com/surajkadam7/bplus_tree

Package Overview
Dependencies
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/surajkadam7/bplus_tree

Source
Go Modules
Version
v0.0.0-20231229094132-06119df0dbb1
Version published
Created
Source

B+ Tree Implementation in Go Generics

Overview

This repository contains an implementation of a B+ tree using Go generics. The B+ tree is a powerful data structure for indexing and organizing data, and this project aims to provide a generic and efficient implementation.

Features

  • Go Generics Implementation: Utilizes Go's generics to create a versatile and type-safe B+ tree.
  • Documentation: Well-documented code with inline comments explaining the logic and functionalities.
  • Test Cases: Comprehensive test suite to ensure correctness and robustness.
  • Randomized Tests: Incorporates randomized tests to cover various scenarios and edge cases.

Usage

Interface (BPTree)

The project exposes an interface, BPTree, for clients to interact with the B+ tree. Here's an overview of the methods available in the interface:

type Comparable interface {
	uint | uint8 | uint16 | uint32 | uint64 | int | int32 | int64 | float32 | float64
}

type BPTree[T1 Comparable, T2 any] interface {
	Get(key T1) (value T2, err error)
	Put(key T1, value T2) (err error)
	Delete(key T1) (err error)
}

Example Usage

Here's an example demonstrating how to use the B+ tree:

package main

import (
	"fmt"
	"log"
)

func main() {
	t := New[int, float64](3)

	err := t.Put(10, 20.0)
	if err != nil {
		log.Println(err)
	}

	value, err := t.Get(10)
	if err != nil {
		log.Println(err)
	}
	fmt.Printf("key : %d value : %f \n", 10, value)

	err = t.Delete(10)
	if err != nil {
		log.Println(err)
	}
}

Contribution Guidelines

Contributions are welcome! If you find issues, have suggestions for improvements, or want to add new features, feel free to create a pull request. Please follow these guidelines:

  • Fork the repository.
  • Create a new branch for your feature/fix.
  • Make changes and add test cases.
  • Create a pull request with a clear description of changes.

Thank you for considering contributing to this project!

About Me

  • Email: Email
  • LinkedIn: LinkedIn

FAQs

Package last updated on 29 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts