
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
node-single_linked_list
Advanced tools
Test task to develop dynamical data structure: single linked list
Single Linked List is dynamical data structure addon to JS that allows you to create linked and linked circular lists.
Note: circular lists is read-only
const Node = require('node-single_linked_list').SingleLinkedList;
let root = new Node(0);
let root2 = new Node(0);
root2.addNode(1);
root2.addNode(0);
root.addNode(15);
root.addNode({'foo':1,'bar':'tender'});
root.getValue(1); //returns '15'
This function always takes last element of the list and set next element link as pointer from parameters:
root.addNext(root); //now list is circular with tail-head connection
Note: if list is circular function will return '-1'
Node.getNextTotal(root); //returns '-1'
This is static function that returns true/false if list circular or not and '-1' if pointer is wrong.
Node.isCircular(root); //returns 'true'
This is static function that returns true/false if list contains palindrome or not and '-1' if pointer is wrong or function is circular.
Node.isPalindrome(root2); //returns 'true'
This is static function that removes duplicates from list (if exist) returns '0' if all ok and '-1' if pointer is wrong or list is circular.
Node.removeDuplicates(root2); //returns '0'
root2.getValue(2); //returns out of border error
npm install node-single_linked_list
npm test
P.S.: for additional info see JSDocs
FAQs
Test task to develop dynamical data structure: single linked list
We found that node-single_linked_list demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.