Socket
Socket
Sign inDemoInstall

github.com/shreya901/golang-doubly-linked-list

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/shreya901/golang-doubly-linked-list


Version published
Created
Source

Linked List

Nodehave the following fields and functions:

  • Val: the node's value (we will use interface{}).
  • Next(): pointer to the next node.
  • Prev(): pointer to the previous node.
  • First(): pointer to the first node (head).
  • Last(): pointer to the last node (tail).

List have the following fields and functions:

  • NewList(args ...interface{}) *List: creates a new linked list preserving the order of the values.
  • First(): pointer to the first node (head).
  • Last(): pointer to the last node (tail).
  • PushBack(v interface{}): insert value at back.
  • PopBack() (interface{}, error): remove value at back.
  • PushFront(v interface{}) : insert value at front.
  • PopFront() (interface{}, error): remove value at front.
  • Reverse(): reverse the linked list.

Running the tests

To run the tests run the command go test from within the exercise directory.

If the test suite contains benchmarks, you can run these with the --bench and --benchmem flags:

go test -v --bench . --benchmem

FAQs

Package last updated on 26 Oct 2020

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