Linear and Nonlinear Data Structures(In progress)

2025. 9. 2. 06:34·Computer Science/Data Structure

Linear Data Structures

A linear data structure is a structure where elements are arranged in a sequential order.

Examples: Linked List, Array, Vector, Stack, Queue.


1) Linked List

A structure where nodes containing data are connected via pointers, maximizing space efficiency.

  • Insertion/Deletion: O(1)
  • Search/Access: O(n)

 

Operation Time Complexity Notes
Lookup O(n) Must traverse from head
Assign O(n) Same reason
Find O(n) Same reason
Insert O(1) Adjust pointers
Remove (head/tail) O(1)  
Remove (middle) O(n) Need to find previous node

 


2) Array

An array is a collection of elements of the same type, stored in contiguous memory, with fixed size.

  • Allows duplicates and maintains order.
  • Best for frequent lookups.
Operation Time Complexity Notes
Lookup(position) O(1) Direct indexing
Assign O(1) Direct indexing
Insert O(n) Elements must shift
Remove O(n) Elements must shift
Find(value) O(n) Linear search

 


3) Vector

A dynamic array — resizable, random access, ordered, allows duplicates.

  • Back insert/delete: O(1) (amortized)
  • Middle insert/delete: O(n)

 


4) Stack

Follows LIFO (Last In First Out).

Used in recursion, algorithms, browser history, etc.

 

 

 

Operation  Time Complexity
Insert (push) O(1)
Remove (pop) O(1)
Lookup/find O(n)

5) Queue

Follows FIFO (First In First Out) — opposite of stack.

Used in task scheduling, printers, etc.

 

Operation  Time Complexity
Insert (enqueue) O(1)
Remove (dequeue) O(1)
Lookup/find O(n)

'Computer Science > Data Structure' 카테고리의 다른 글

Time complexity and Space complexity  (0) 2025.08.11
'Computer Science/Data Structure' 카테고리의 다른 글
  • Time complexity and Space complexity
JTB
JTB
웹/앱 개발 정보를 공유하고 있습니다.
  • JTB
    JTechBlog
    JTB
  • 전체
    오늘
    어제
    • All About Programming;) N
      • Computer Science
        • Terminology and Concepts
        • Network
        • Operating System
        • Database
        • Data Structure
      • Frontend
        • Javascript Essentials
        • Perfomance Optimization
        • JS Patterns
        • Next.js
        • Flutter
      • Backend
        • Node.js
      • DevOps
        • Docker & Kubernetes
      • Coding Test N
        • LeetCode N
        • Programmers
      • Tech Books & Lectures
        • Javascript_Modern JS Deep d..
        • Network_IT 엔지니어를 위한 네트워크 입문
      • Projects
        • PolyLingo_2025
        • Build Your Body_2024
        • JStargram_2021
        • Covid19 Tracker_2021
        • JPortfolio_2021
      • BootCamp_Codestates
        • TIL
        • TILookCloser
        • Pre Tech Blog
        • IM Tech Blog
        • Daily Issues and DeBugging
        • First Project
        • Final Project
        • Sprint Review
        • Good to Know
        • Socrative Review
        • HTML & CSS
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • 글쓰기
    • 관리
  • 공지사항

  • 인기 글

  • 태그

    JavaScript
    Time complexity and Space complexity
    Network
    testing
    need a database
    이벤트
    structure of os
    모던 자바스크립트 Deep Dive
    Threads and Multithreading
    딥다이브
    js pattern
    스코프
    VoiceJournal
    자바스크립트
    Data Structure
    mobile app
    How memory manage data
    leetcode
    database
    Operating System
    DOM
    자바스크립트 딥다이브
    TCP/IP
    Binary Tree BFS
    CPU scheduling algorithm
    프론트엔드 성능 최적화 가이드
    polylingo
    indie hacker
    Shared resources
    커리어
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
JTB
Linear and Nonlinear Data Structures(In progress)
상단으로

티스토리툴바