
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
linkedlist_for_begginer
Advanced tools
A simple implementation of a Linked List data structure in TypeScript.
์ฌ์ฌ์ฉ์ ์ํ linked list ๋ชจ๋
LinkedList๋ TypeScript๋ก ๊ตฌํ๋ ๊ฐ๋จํ ๋งํฌ๋ ๋ฆฌ์คํธ(Linked List) ์๋ฃ๊ตฌ์กฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
npm์ ์ฌ์ฉํ์ฌ linkedlist ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ค์นํ ์ ์์ต๋๋ค:
npm install linkedlist
ํ๋ก์ ํธ์์ linkedlist ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๋จผ์ LinkedList ํด๋์ค๋ฅผ import ํด์ผ ํฉ๋๋ค.
import LinkedList from "linkedlist";
์๋ก์ด ๋งํฌ๋ ๋ฆฌ์คํธ ์์ฑ:
const list = new LinkedList();
API Reference
| Function | Description |
|---|---|
append(data) | ์ฃผ์ด์ง ๋ฐ์ดํฐ๋ฅผ ๋ฆฌ์คํธ ๋์ ์ถ๊ฐํฉ๋๋ค. |
insert(data, position) | ์ฃผ์ด์ง ๋ฐ์ดํฐ๋ฅผ ๋ฆฌ์คํธ์ ์ง์ ๋ ์์น์ ์ฝ์ ํฉ๋๋ค. |
remove(data) | ๋ฆฌ์คํธ์์ ์ฃผ์ด์ง ๋ฐ์ดํฐ์ ์์๋ฅผ ์ ๊ฑฐํฉ๋๋ค. |
print() | ๋งํฌ๋ ๋ฆฌ์คํธ๋ฅผ ์ฝ์์ ์ถ๋ ฅํฉ๋๋ค. (๋๋ฒ๊น ์ฉ) |
append(data)data (any): ์ฝ์
ํ ๋ฐ์ดํฐ๋ก, ๋งํฌ๋ ๋ฆฌ์คํธ์ ์ ์ฅ๋ ๊ฐ์
๋๋ค. data๋ ์ด๋ค ํ์
์ ๋ฐ์ดํฐ๋ ๊ฐ๋ฅํฉ๋๋ค.
์ด ๋ฉ์๋๋ ์ฃผ์ด์ง data๋ฅผ ์๋ก์ด ๋
ธ๋๋ก ์์ฑํ์ฌ ๋งํฌ๋ ๋ฆฌ์คํธ์ ๋์ ์ถ๊ฐํฉ๋๋ค.list.append(1) -- ์์๋ฅผ ๋งํฌ๋ ๋ฆฌ์คํธ ๋์ ์ถ๊ฐ
insert(data, position)data (any): ์ฝ์
ํ ๋ฐ์ดํฐ๋ก, ๋งํฌ๋ ๋ฆฌ์คํธ์ ์ ์ฅ๋ ๊ฐ์
๋๋ค. data๋ ์ด๋ค ํ์
์ ๋ฐ์ดํฐ๋ ๊ฐ๋ฅํฉ๋๋ค.
position (number): ๋ฐ์ดํฐ๋ฅผ ์ฝ์
ํ ์์น๋ก, 0๋ถํฐ ์์ํ์ฌ ๋ฆฌ์คํธ์ ์ธ๋ฑ์ค๋ฅผ ๋ํ๋
๋๋ค. ์ฆ, position์ด 0์ธ ๊ฒฝ์ฐ ๋ฐ์ดํฐ๊ฐ ๋ฆฌ์คํธ์ ๋งจ ์์ ์ฝ์
๋๊ณ , position์ด ๋ฆฌ์คํธ์ ๊ธธ์ด๋ณด๋ค ํฐ ๊ฒฝ์ฐ ๋ฐ์ดํฐ๋ ๋ฆฌ์คํธ์ ๋งจ ๋์ ์ฝ์
๋ฉ๋๋ค.
list.insert(4, 1) -- ์์๋ฅผ ๋งํฌ๋ ๋ฆฌ์คํธ ํน์ ์์น์ ์ถ๊ฐ
remove(data)data (any): ๋งํฌ๋ ๋ฆฌ์คํธ์์ ์ญ์ ํ๊ณ ์ ํ๋ ๋
ธ๋์ ๋ฐ์ดํฐ์
๋๋ค. ์ด ํจ์๋ ๋ฆฌ์คํธ์์ ํด๋น ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง ๋
ธ๋๋ฅผ ์ฐพ์์ ์ญ์ ํฉ๋๋ค. data๋ ์ด๋ค ํ์
์ ๋ฐ์ดํฐ๋ ๊ฐ๋ฅํฉ๋๋ค.list.remove(2) -- ๋งํฌ๋ ๋ฆฌ์คํธ์์ ์์ ์ ๊ฑฐ
print()list.print() -- ๋งํฌ๋ ๋ฆฌ์คํธ์ ์ ์ฅ๋ ๋ฐ์ดํฐ๊ฐ ์์๋๋ก ์ฝ์์ ์ถ๋ ฅ
FAQs
A simple implementation of a Linked List data structure in TypeScript.
We found that linkedlist_for_begginer 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.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socketโs Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScriptโs Date object.