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
All 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
Programming Interviews Exposed

You're reading from   Programming Interviews Exposed Coding Your Way Through the Interview

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Wiley
ISBN-13 9781119418474
Length 384 pages
Edition 4th Edition
Tools
Concepts
Arrow right icon
Authors (3):
Arrow left icon
John Mongan John Mongan
Author Profile Icon John Mongan
John Mongan
Noah Suojanen Kindler Noah Suojanen Kindler
Author Profile Icon Noah Suojanen Kindler
Noah Suojanen Kindler
Eric Giguère Eric Giguère
Author Profile Icon Eric Giguère
Eric Giguère
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Preface Introduction 1 Before the Search FREE CHAPTER 2 The Job Application Process 3 The Phone Screen 4 Approaches to Programming Problems 5 Linked Lists 6 Trees and Graphs 7 Arrays and Strings 8 Recursion 9 Sorting 10 Concurrency 11 Object-Oriented Programming 12 Design Patterns 13 Databases 14 Graphics and Bit Manipulation 15 Data Science, Random Numbers, and Statistics 16 Counting, Measuring, and Ordering Puzzles 17 Graphical and Spatial Puzzles 18 Knowledge-Based Questions 19 Nontechnical Questions End User License Agreement
Appendix: Résumés

BASIC LINKED LIST OPERATIONS

Successfully solving linked list problems requires a thorough understanding of how to operate on linked lists. This includes tracking the head element so that the list doesn’t get lost, traversing the list, and inserting and deleting list elements. These operations are much more straightforward with a doubly linked list, so we focus on the pitfalls of implementing these operations for singly linked lists.

Tracking the Head Element

The head element of a singly linked list must always be tracked; otherwise, the list will be lost—either garbage collected or leaked, depending on the language. This means that the pointer or reference to the head of the list must be updated when a new element is inserted ahead of the first element or when the existing first element is removed from the list.

Tracking the head element becomes a problem when you alter the list inside a function or method, because the caller must be made aware of the new head element...

lock icon The rest of the chapter is locked
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 $15.99/month. Cancel anytime
Visually different images