Object Oriented Programming using Java - Introduction To HashSets Part 2
00:00 Intro & quick recap of Part 1 00:17 Why a HashSet combines ArrayList + LinkedList ideas 01:15 The 3 building blocks: array, hash function, linked list 02:05 Buckets: visualising the contiguous “outer” array 03:35 Walking an insertion through the hash function (value 5) 04:50 Second example: inserting 100 into a different bucket 06:15 Collisions & chaining: when 8 lands on bucket 0 07:45 Linked‑lists inside buckets (fragmented “inner” storage) 09:10 Memory and speed benefits of this hybrid design 10:35 Time‑complexity breakdown (best, average, worst) 12:30 When **not** to use a HashSet & common pitfalls 13:40 Wrap‑up – next steps in the HashMap series Welcome back to the HashMap / HashSet deep dive! 🚀 In Part 1 we compared contiguous (ArrayList) vs fragmented (LinkedList) memory. Today we put it all together and show how a HashSet achieves near‑instant look‑ups by blending those two models. What you’ll learn in this video How Java & .NET implement sets differently (Red‑Black tree vs classic bucket+chain) The three core components of any hash‑based collection: A fixed‑size bucket array A user‑defined (or JVM‑supplied) hash function A per‑bucket linked list (chaining) to handle collisions Step‑by‑step insertion: hashing 5, 100, and 8 into their buckets Collision handling with chaining and why order is not guaranteed Big‑O analysis – why average‑case O(1) is so powerful and when worst‑case O(n) appears Practical advice: when a HashSet/HashMap is the right tool—and when a sorted or sequential structure is better By the end you’ll be able to explain and justify the internal mechanics of a HashSet to your classmates, interviewers, or dev team. 🔔 Stay tuned Part 3 will dive into custom hash functions, load factors, and re‑hashing. Hit subscribe so you don’t miss it! 📂 Full Playlist ▪️ Object‑Oriented Programming in Java 💬 Got questions? Drop them below—feedback and corrections are always welcome. Happy coding! ✨ #Java #HashSet #HashMap #DataStructures #ComputerScience #BigO
Download
0 formatsNo download links available.