New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/hIMEI29A/goulist

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hIMEI29A/goulist

  • v0.0.0-20210710082620-26c3f558fc15
  • Source
  • Go
  • Socket score

Version published
Created
Source

goulist

Goulist package is an Urolled Linked List written in pure Go.

GoDoc Apache-2.0 License Go Report Card Coverage Status Build Status

TOC

Version

1.0.3

Install

go get github.com/hIMEI29A/goulist

Content

Unrolled linked list

Unrolled linked list (ULL) is an doubly linked list each node of which holds up to a certain maximum number of elements, typically just large enough so that the node fills a single cache line or a small multiple thereof.

It has a special algorithm for insertion and deletion of elements.

As Wikipedia says,

To insert a new element, we simply find the node the element should be in and insert the element into the elements array, incrementing numElements. If the array is already full, we first insert a new node either preceding or following the current one and move half of the elements in the current node into it.

To remove an element, we simply find the node it is in and delete it from the elements array, decrementing numElements. If this reduces the node to less than half-full, then we move elements from the next node to fill it back up above half. If this leaves the next node less than half full, then we move all its remaining elements into the current node, then bypass and delete it.

After deletion, all nil elements in the node are shifted to the right to avoid empty spaces.

Default constructor of ULL creates list the length of the arrays (slices in fact) at the nodes of which is equal to cache line size. Creation with custom array (slice) length is also possible.

See Wikipedia article for details.

Related

Java implementation

Another Golang implementation, but it seems does not work as expected.

Usage

Import package:

import (
	"github.com/hIMEI29A/goulist"
)

FAQs

Package last updated on 10 Jul 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc