Level Up Your Core Programming Skills
Jay Wengrow

#Data_Structures
#Algorithms
🧠 راهنمای ساده و کاربردی ساختارهای داده و الگوریتمها، ویرایش دوم
🚀 Data Structureها و Algorithmها خیلی فراتر از مفاهیم انتزاعی هستن. تسلط روی اونها بهت کمک میکنه کدی کارآمدتر بنویسی؛ کدی که سریعتر اجرا میشه و حافظه کمتری مصرف میکنه. این موضوع برای اپلیکیشنهای امروزی که هر روز بیشتر روی پلتفرمهای Mobile اجرا میشن و حجم بیشتری از داده رو مدیریت میکنن، اهمیت زیادی داره.
😵 مشکل اینجاست که خیلی از منابع این حوزه بیش از حد پیچیده نوشته شدهاند. بیشتر کتابها سراغ اصطلاحات سنگین ریاضی میرن و اگر ریاضیدان نباشی، فهمیدن اینکه دقیقا چه اتفاقی داره میفته میتونه سخت باشه. حتی بعضی کتابهایی که ادعا میکنن Algorithmها رو «ساده» آموزش میدن، انگار فرض کردن خواننده مدرک پیشرفته ریاضی داره. همین موضوع باعث شده خیلیها از Data Structureها و Algorithmها فاصله بگیرن و فکر کنن برای فهمیدن این مباحث بهاندازه کافی «باهوش» نیستن.
💡 واقعیت اینه که تقریبا همهچیز در Data Structureها و Algorithmها در نهایت به منطق ساده و Common Sense برمیگرده. Mathematical Notation فقط یک زبان خاصه و هر چیزی که با زبان ریاضی بیان میشه، میتونه با اصطلاحات ساده و قابلفهم هم توضیح داده بشه. نویسنده در این کتاب با همین زبان ساده و تعداد زیادی Diagram، مفاهیم رو بهشکلی روشن و حتی لذتبخش توضیح میده.
🛠️ کتاب تلاش میکنه این مفاهیم رو واقعی و کاربردی کنه و ایدههایی ارائه بده که بتونی از همین امروز در کدت استفاده کنی. در طول مسیر Computer Science جذابی هم یاد میگیری، اما هدف اصلی اینه که مفاهیمی که ظاهرا انتزاعی هستن به ابزارهایی کاملا عملی تبدیل بشن تا در پایان کتاب کد بهتر و نرمافزار سریعتری بنویسی.
⚙️ Algorithmها و Data Structureها فقط بحثهای تئوری نیستن. تسلط روی اونها باعث میشه کدت سریعتر و کارآمدتر اجرا بشه؛ چیزی که مخصوصا برای Web Appها و Mobile Appهای امروزی اهمیت زیادی داره. کتاب یک رویکرد عملی ارائه میده و با مثالهایی در JavaScript، Python و Ruby تکنیکها و سناریوهای واقعیای رو بررسی میکنه که میتونی در کدهای روزمره پروداکشن استفاده کنی.
🆕 این ویرایش دوم بازبینیشده، فصلهای جدیدی درباره Recursion، Dynamic Programming و استفاده از Big O در کدهای روزمره اضافه کرده.
📈 یاد میگیری با Big O Notation کارایی کدت رو اندازهگیری و توضیح بدی و Algorithm رو طوری تغییر بدی که سریعتر اجرا بشه. بررسی میکنی انتخاب بین Arrayها، Linked Listها و Hash Tableها چطور میتونه تاثیر بزرگی روی پرفورمنس کدت داشته باشه.
🔁 از Recursion برای حل مسئلههای پیچیده استفاده میکنی و Algorithmهایی میسازی که میتونن بهشکل چشمگیری سریعتر از روشهای جایگزین اجرا بشن. بعد سراغ Data Structureهای پیشرفته مثل Binary Treeها و Graphها میری که برای Scale کردن اپلیکیشنهای تخصصی مثل شبکههای اجتماعی و نرمافزارهای Mapping کاربرد دارن.
⚡ حتی با یک Keyword آشنا میشی که میتونه یک Turbo Boost واقعی به کدت بده. هر فصل هم تمرینهایی برای تقویت مهارتها داره و Solutionهای کامل اونها ارائه شده.
🎯 با استفاده از این تکنیکها میتونی از همین امروز کد سریعتر و مقیاسپذیرتری بنویسی.
📖 فهرست مطالب
فصل ۱. چرا Data Structureها اهمیت دارن
فصل ۲. چرا Algorithmها اهمیت دارن
فصل ۳. آشنایی با Big O Notation
فصل ۴. افزایش سرعت کد با Big O
فصل ۵. بهینهسازی کد با Big O و بدون اون
فصل ۶. بهینهسازی برای سناریوهای خوشبینانه
فصل ۷. Big O در کدهای روزمره
فصل ۸. Lookup فوقسریع با Hash Tableها
فصل ۹. نوشتن کد تمیز و زیبا با Stackها و Queueها
فصل ۱۰. Recursion با Recursion
فصل ۱۱. یادگیری نوشتن به سبک Recursive
فصل ۱۲. Dynamic Programming
فصل ۱۳. Algorithmهای Recursive برای افزایش سرعت
فصل ۱۴. Data Structureهای مبتنی بر Node
فصل ۱۵. افزایش سرعت همهچیز با Binary Search Treeها
فصل ۱۶. مدیریت درست Priorityها با Heapها
فصل ۱۷. کار با Trie
فصل ۱۸. متصل کردن همهچیز با Graphها
فصل ۱۹. مدیریت محدودیتهای Space
فصل ۲۰. تکنیکهای Code Optimization
📝 نقد و بررسی
💭 «اگر مثل من بدون داشتن یک آموزش سنتی Computer Science وارد برنامهنویسی شدی، این کتاب راه فوقالعادهایه برای یاد گرفتن مبانی تفکر الگوریتمی و همینطور نحوه استفاده و پیادهسازی مجموعهای از Data Structureهای رایج. همه این مطالب با زبان ساده، حداقل اصطلاحات تخصصی اضافی و لحنی سرگرمکننده و دلنشین ارائه شدهاند. برای هر کسی که میخواد دانش پایه برنامهنویسی خودش رو تقویت کنه، کتاب فوقالعادهایه.»
— جان اندرسون، VP of Technology در Infinity Interactive
💭 «بیش از ۳۰ ساله برنامهنویسی میکنم و یکی از چیزهایی که یاد گرفتم اینه که همیشه باید به اصول پایه برگردی. A Common-Sense Guide to Data Structures and Algorithms راه خیلی خوبی بود تا فرضهایی رو که طی سالها ساخته بودم دوباره بررسی کنم و درکم از مهارتهای اصلیای رو که در آینده استفاده میکنم محکمتر کنم.
این کتاب رو فقط برای موفق شدن در Whiteboard Testها نخر؛ اون Testها بههرحال افتضاحن. این کتاب رو بخون تا مسیرت به سمت تفکر الگوریتمی واقعی رو ادامه بدی. چه اول مسیر حرفهایت باشی و چه مثل من سالها تجربه داشته باشی، به یک Toolbox کامل از Data Structureها و Algorithmهای رایج و غیررایج نیاز داری. حتی بهتر اینکه یاد میگیری کد رو چطور، چه زمانی و چرا بهینه کنی؛ اول کاری کن درست کار کنه، بعد سریعش کن، بعد Elegantش کن و در طول مسیر Trade-Offها رو یاد بگیر.»
— اسکات هنسلمن، Microsoft Programmer، Professor، Blogger و Podcaster
💭 «با وجود اینکه ۱۵ ساله بهعنوان متخصص نرمافزار فعالیت میکنم، از این ویرایش بهروز چیزهای زیادی یاد گرفتم. این همون کتابیه که آرزو میکردم ۲۰ سال پیش، وقتی بهعنوان دانشجوی کارشناسی این مفاهیم رو یاد میگرفتم، در اختیار داشتم. انگار یک Superpower جدید پیدا کردم که کمک میکنه فرصتهایی رو ببینم که Hash Tableها برای بهتر کردن Big O کد فراهم میکنن.»
— نایجل لوری، Principal Consultant در Lemmata
💭 «ویرایش دوم این کتاب اضافههای ارزشمند زیادی به منبعی اضافه کرده که از قبل هم برای یادگیری Data Structureها و Algorithmها عالی بود. توضیحهای سادهتر درباره موضوعهایی مثل Dynamic Programming و سؤالهای پایان هر فصل برای بررسی میزان یادگیری، این کتاب رو برای دولوپرها چه با پیشزمینه Computer Science و چه بدون اون، به منبعی بسیار ارزشمند تبدیل کرده.»
— جیسون پایک، Senior Software Engineer در KEYSYS Consulting
💭 «یک مقدمه عالی برای Algorithmها و Data Structureها مخصوص افراد تازهکار. شدیدا پیشنهاد میشه!»
— برایان شاو، Lead Developer در Schau Consulting
👤 این کتاب برای چه کسانیه؟
🎓 اگر دانشجوی Computer Science هستی و دنبال منبعی میگردی که Data Structureها و Algorithmها رو با زبان ساده توضیح بده، این کتاب میتونه مکمل خیلی خوبی برای Textbookهای کلاسیک دانشگاهیت باشه.
💻 اگر دولوپر تازهکاری هستی که برنامهنویسی پایه رو بلدی اما میخوای مبانی Computer Science رو یاد بگیری تا کد بهتر بنویسی و دانش و مهارتهای برنامهنویسیت رو افزایش بدی، این کتاب برای تو مناسبه.
🧠 اگر یک دولوپر خودآموخته هستی که هیچوقت Computer Science رسمی نخوندی، یا حتی قبلا خوندی ولی بیشترش رو فراموش کردی، کتاب کمکت میکنه از قدرت Data Structureها و Algorithmها برای نوشتن کد مقیاسپذیرتر و Elegantتر استفاده کنی.
🤝 نویسنده تلاش کرده کتاب برای افراد با هر سطحی از مهارت قابلدسترسی و لذتبخش باشه.
🆕 چه چیزهایی در ویرایش دوم جدید شده؟
📚 چند سال بعد از انتشار ویرایش اول، نویسنده فرصت داشته این موضوعها رو برای گروههای مختلف تدریس کنه. در طول این مدت، توضیحهای خودش رو مرتب بهبود داده و موضوعهای تازهای پیدا کرده که به نظرش مهم و جذاب بودن. همینطور تقاضای زیادی برای تمرینهای عملی وجود داشته تا خوانندهها بتونن مفاهیم رو واقعا تمرین کنن.
✏️ محتوای بازبینیشده: فصلهای اصلی بهشکل قابلتوجهی برای شفافیت بیشتر بازنویسی شدهاند. خیلی از بخشهای نسخه اول کاملا دوباره نوشته شدهاند و بخشهای جدیدی هم اضافه شده.
🧩 فصلها و موضوعهای جدید: ویرایش دوم شش فصل جدید داره. فصلهای Big O in Everyday Code و Techniques for Code Optimization کاملا روی کد روزمره تمرکز دارن و نشون میدن Data Structureها و Algorithmها چطور به نوشتن نرمافزار کارآمدتر کمک میکنن.
🔁 برای Recursion هم محتوای خیلی بیشتری اضافه شده. علاوه بر فصل قبلی، یک فصل کاملا جدید با عنوان Learning to Write in Recursive اضافه شده تا نحوه نوشتن Recursive Code رو آموزش بده؛ موضوعی که برای خیلی از تازهکارها گیجکننده است.
🧠 فصل Dynamic Programming هم اضافه شده که یکی از موضوعهای مهم برای افزایش کارایی Recursive Code محسوب میشه. همچنین بهدلیل افزایش تقاضا برای یادگیری Heapها و Trieها، فصلهای Keeping Your Priorities Straight with Heaps و It Doesn't Hurt to Trie به کتاب اضافه شدهاند.
🛠️ تمرینها و Solutionها: حالا هر فصل چندین تمرین عملی داره تا بتونی موضوعهای همون فصل رو دستبهکار تمرین کنی. Solutionهای کامل هم در یکی از Appendixهای انتهای کتاب قرار گرفتن و همین موضوع، ویرایش دوم رو به یک تجربه یادگیری کاملتر تبدیل کرده.
👤 درباره نویسنده
👨💻 جی ونگرو مدرس و Developer باتجربهایه که خودش رو وقف آموزش برنامهنویسی به دیگران کرده.
🚀 او بنیانگذار و CEO شرکت Actualize، یک Coding Bootcamp و Apprenticeship سراسری، و همینطور Anyone Can Learn To Code است؛ یک مجموعه آموزشی که از طریق Tutorialهای آنلاین، برنامه آموزشی Computer Science برای K-12 و Corporate Training به افراد مختلف برنامهنویسی آموزش میده.
Data structures and algorithms are more than abstract concepts. Mastering them enables you to write code that is efficient, leading to software that runs faster and consumes less memory. This is a big deal for today’s software applications, which exist on increasingly mobile platforms and handle increasingly greater amounts of data.
The problem with most resources on these subjects, though, is that they are...well...obtuse. Most texts go heavy on the math jargon, and if you are not a mathematician, it can be difficult to grasp what on Earth is going on. Even books that claim to make algorithms “easy” seem to assume that the reader has an advanced math degree. Because of this, too many people shy away from these concepts, feeling that they are not “smart” enough to understand them.
The truth, though, is that everything about data structures and algorithms boils down to common sense. Mathematical notation itself is simply a particular language, and everything in math can also be explained with common-sense terminology. In this book, I use that common-sense language (plus a lot of diagrams!) to explain these concepts in simple, and dare I say, enjoyable ways.
I go out of my way to make these concepts real and practical with ideas that you can make use of today. Sure, you’ll learn some really cool computer science along the way. But this book is about taking that seemingly abstract stuff and making it directly practical. You’ll be writing better code and faster software by the time you’re done reading this book.
Algorithms and data structures are much more than abstract concepts. Mastering them enables you to write code that runs faster and more efficiently, which is particularly important for todays web and mobile apps. Take a practical approach to data structures and algorithms, with techniques and real-world scenarios that you can use in your daily production code, with examples in JavaScript, Python, and Ruby. This new and revised second edition features new chapters on recursion, dynamic programming, and using Big O in your daily work.
Use Big O notation to measure and articulate the efficiency of your code, and modify your algorithm to make it faster. Find out how your choice of arrays, linked lists, and hash tables can dramatically affect the code you write. Use recursion to solve tricky problems and create algorithms that run exponentially faster than the alternatives. Dig into advanced data structures such as binary trees and graphs to help scale specialized applications such as social networks and mapping software. You'll even encounter a single keyword that can give your code a turbo boost. Practice your new skills with exercises in every chapter, along with detailed solutions.
Use these techniques today to make your code faster and more scalable.Data structures and algorithms are more than abstract concepts. Mastering them enables you to write code that is efficient, leading to software that runs faster and consumes less memory. This is a big deal for today’s software applications, which exist on increasingly mobile platforms and handle increasingly greater amounts of data.
The problem with most resources on these subjects, though, is that they are...well...obtuse. Most texts go heavy on the math jargon, and if you are not a mathematician, it can be difficult to grasp what on Earth is going on. Even books that claim to make algorithms “easy” seem to assume that the reader has an advanced math degree. Because of this, too many people shy away from these concepts, feeling that they are not “smart” enough to understand them.
The truth, though, is that everything about data structures and algorithms boils down to common sense. Mathematical notation itself is simply a particular language, and everything in math can also be explained with common-sense terminology. In this book, I use that common-sense language (plus a lot of diagrams!) to explain these concepts in simple, and dare I say, enjoyable ways.
I go out of my way to make these concepts real and practical with ideas that you can make use of today. Sure, you’ll learn some really cool computer science along the way. But this book is about taking that seemingly abstract stuff and making it directly practical. You’ll be writing better code and faster software by the time you’re done reading this book.
Table of Contents
1. Why Data Structures Matter
2. Why Algorithms Matter
3. O Yes! Big O Notation
4. Speeding Up Your Code with Big O
5. Optimizing Code with and Without Big O
6. Optimizing for Optimistic Scenarios
7. Big O in Everyday Code
8. Blazing Fast Lookup with Hash Tables
9. Crafting Elegant Code with Stacks and Queues
10. Recursively Recurse with Recursion
11. Learning to Write in Recursive
12. Dynamic Programming
13. Recursive Algorithms for Speed
14. Node-Based Data Structures
15. Speeding Up All the Things with Binary Search Trees
16. Keeping Your Priorities Straight with Heaps
17. It Doesn·t Hurt to Trie
18. Connecting Everything with Graphs
19. Dealing with Space Constraints
20. Techniques for Code Optimization
Early Praise for A Common-Sense Guide to Data Structures and Algorithms, Second Edition
“If you—like me—got into coding without the benefit of a ‘traditional’ computer science education, this book is a fantastic way to pick up the basics of how to think about algorithms, as well as how to use and implement a range of common data structures. All that, presented in plain language with a minimum of jargon, and a fun, pleasant tone! A great read for folks looking to pick up foundational programming knowledge.”
➤ John Anderson
VP, Technology, Infinity Interactive
“I’ve been coding for well over 30 years, and one thing I’ve learned is to ALWAYS return to basics. A Common-Sense Guide to Data Structures and Algorithms has been a great way for me to re-assert all the assumptions I’ve made in the past and re-cement my understanding of the core skills I’ll use in the future. Don’t buy this book if you think it’ll help you on whiteboarding tests. Those tests suck anyway. Buy this book to continue a path to real algorithmic thinking. Whether you’re early in your career or further along like me, you want a full toolbox of data structures and the common (and not so common) algorithms that complement them. Even better, you’ll learn how, when, and why to optimize your code. You’ll make it work, make it fast, then make it elegant—and learn the trade-offs along the way.”
➤ Scott Hanselman
Microsoft Programmer, Professor, Blogger, Podcast
“Despite being a software professional for fifteen years, I’ve learnt a great deal from this updated edition. This is also the book I wish I’d had twenty years ago, when learning these concepts as an undergraduate. It’s like I have a new superpower tuning me in to the opportunities hash tables can provide to improve the Big O of code. Forget what it looks like, forget what it feels like, forget what you think it is, forget what habits you’ve accumulated: forget all that stuff; it won’t give you the most efficient Big O!”
➤ Nigel Lowry
Principal Consultant, Lemmata
“The second edition of this book includes many worthy additions to an already excellent resource for learning data structures and algorithms. Additional common-sense explanations of topics like dynamic programming, and questions to check your understanding at the end of each chapter, make this book invaluable to developers with or without a computer science background.”
➤ Jason Pike
Senior Software Engineer, KEYSYS Consulting
“The perfect introduction to algorithms and structures for beginners. Highly recommended!”
➤ Brian Schau
Lead Developer, Schau Consulting
Who Is This Book For?
This book is ideal for several audiences:
• You are a computer science student who wants a text that explains data structures and algorithms in plain English. This book can serve as a supplement to whatever “classic” textbook you happen to be using.
• You are a beginning developer who knows basic programming, but wants to learn the fundamentals of computer science to write better code and increase your programming knowledge and skills.
• You are a self-taught developer who has never studied formal computer science (or a developer who did but forgot everything!) and wants to leverage the power of data structures and algorithms to write more scalable and elegant code.
Whoever you may be, I tried to write this book so it can be accessed and enjoyed by people of all skill levels.
What’s New in the Second Edition
Why a second edition? In the few years since the original edition was published, I’ve had the opportunity to teach these topics to various audiences. Over time, I continued to refine my explanations as well as discover additional topics that I thought were exciting and important. There was also quite a bit of demand for hands-on exercises that would help people gain practice with these concepts.
Accordingly, the second edition has the following new features:
Jay Wengrow is an experienced educator and developer who is dedicated to teaching the world to code. He is the founder and CEO of Actualize, a national coding bootcamp and apprenticeship; Anyone Can Learn To Code, an educational company teaching everyone to code through online tutorials, K-12 computer science curriculum, and corporate training.









