dll-ts
TypeScript icon, indicating that this package has built-in type declarations

0.9.6 • Public • Published

DoublyLinkedList-JS


자바스크립트로 구현한 양방향 연결 구조인 doublyLinkedList 자료구조입니다

해당 자료구조는 이터러블 프로토콜을 준수합니다

Installation


npm i dll-ts --save

Test

npm run test

Using

import Dll from 'dll-ts';

const dll = new Dll();

dll.push( 100 ).push( 300 );

for ( const item of dll ){
    console.log( "item" , item ); // 100 , 300
}

console.log( dll.tail ) // 300;

Properties

head : Node<T>;            // 첫 번째 Node 입니다
tail : Node<T>;            // 마지막 Node 입니다
get length() : number;      // linkedList 의 길이입니다

Methods


push( val : T ) : this;                             // 마지막 Node 를 삽입합니다
pop() : Node<T> | void;                             // 마지막 Node 를 제거합니다
shift() :  Node<T> | void;                          // 첫번째 Node 를 제거합니다
unshift( val : T ) : this;                          // 첫번째 Node 를 삽입합니다
get( index : number ) : Node<T> | null;             // index Node 를 반환합니다

set( index : number , val : T ) : boolean;          // index Node 를 설정합니다
insert( index : number , val : T ) : boolean;       // index Node 를 삽입합니다
remove( index : number ) : Node<T> | void;          // index Node 를 제거합니다
rotate( index : number ) : Node<T> | null ;         // index 부터 재정렬 후 index Node 를 반환합니다
reverse() : this;                                   // list 를 뒤집습니다

[ Symbol.iterator ]() : IterableIterator<Node<T>>   // 이터레이터를 반환합니다

Package Sidebar

Install

npm i dll-ts

Weekly Downloads

4

Version

0.9.6

License

MIT

Unpacked Size

18.4 kB

Total Files

8

Last publish

Collaborators

  • divinity6