Socket
Socket
Sign inDemoInstall

@wholebuzz/binary-merge

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @wholebuzz/binary-merge

2-way merge


Version published
Maintainers
1
Install size
4.25 kB
Created

Readme

Source

binary-merge

Merges a pair of sorted arrays.

Use

First install via npm:

npm install binary-merge

Then you can use the algorithm as follows:

var merge = require("binary-merge")


console.log(merge([1,3,7], [2,4,6]))

// Prints:
//
//    1,2,3,4,6,7
//

require("binary-merge")(a, b[, compare, result])

The arguments are as follows:

  • a a sorted array
  • b again, a sorted array
  • compare an optional comparison function
  • result an optional array which gets the result of merging a and b. If not specified, a new array is allocated.

Returns: A sorted array.

Time Complexity: O(a.length + b.length)

Credits

(c) 2013 Mikola Lysenko. MIT License

Keywords

FAQs

Last updated on 03 Oct 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc