Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning JavaScript Data Structures and Algorithms

You're reading from   Learning JavaScript Data Structures and Algorithms Enhance your problem-solving skills in JavaScript and TypeScript

Arrow left icon
Product type Paperback
Published in Sep 2026
Publisher Packt
ISBN-13 9781836205395
Length 615 pages
Edition 4th Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Loiane Groner Loiane Groner
Author Profile Icon Loiane Groner
Loiane Groner
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Learning JavaScript Data Structures and Algorithms, Fourth Edition: Enhance your problem-solving skills in JavaScript and TypeScript
1 Introducing Data Structures and Algorithms in JavaScript FREE CHAPTER 2 Big O notation 3 Arrays 4 Stacks 5 Queues and Deques 6 Linked Lists 7 Sets 8 Dictionaries and Hashes

Reviewing the efficiency of the linked lists

Let's review the efficiency of each method by review the Big O notation in terms of time of execution:

Method Singly Doubly Circular Explanation
append O(n) O(1) O(n) In singly and circular lists, we must traverse to the end to append. Doubly lists have a tail reference for constant time append.
prepend O(1) O(1) O(n) All lists can add a new node as the head directly. However, in circular lists, we must update the last node's next pointer to the new head.
insert O(n) O(n) O(n) For all types, we need to traverse to the position to insert.
removeAt O(n) O(n) O(n) Similar to insertion, traversal to the position is required. Doubly lists have an optimization when removing the tail ( O(1) ), but this is less common than removing from an arbitrary position.
remove O(n) O(n) O(n) Searching for the data takes O(n) in all cases, then removal itself is either O(1) (if the node is found at the head) or O(n) (traversing to the node...
lock icon The rest of the chapter is locked

Subscribe to access the full title

Advance your knowledge in tech

A Packt subscription gives you instant online access to our library of over 8,000 practical eBooks and videos, constantly updated with the latest in tech
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon