Skip to content

Latest commit

 

History

History
93 lines (53 loc) · 3.84 KB

2_Difference.md

File metadata and controls

93 lines (53 loc) · 3.84 KB

📚 GL Threads vs Traditional Doubly Linked Lists - The Detailed Guide

🖼 Traditional Doubly Linked Lists in Memory

  • Each node has left, right, and data members.
  • The data member holds the address of the application data.

🖼 GL Threads in Memory

  • Each GL Node (a node in GL Threads) only contains left and right pointers.
  • There is no separate data member pointing to the application data.

🎭 Terminology Clarification

  • Thread: Refers to glue-based doubly linked lists.
  • GL Node: Refers to a node in a thread.

🎈 The "Glue" Concept

🤝 Application Data in GL Threads

  • In GL Threads, the application data is "glued" directly to the GL Node.

🍬 The Sticky Gum Analogy

  • Think of the application data as having "sticky gum" that allows it to stick itself to GL Nodes.

📎 The Glue Member

  • The application data contains a member which is a GL Node.
  • This member, often termed as "glue," allows the application data to adhere itself to a thread.

🤓 High-Level Significance of "Glue"

  • The term "glue" signifies a mechanism that allows an object (here, application data) to stick to another object (here, GL Nodes in a thread).

Interview Questions on GL Threads vs Traditional Doubly Linked Lists 📘

Introduction 🌟

Hey guys! Today we're diving deeper into GL threads, especially contrasting them with traditional doubly linked lists. This will help prepare you for interviews that could include questions about these data structures.


Core Concepts 🎯

Traditional Doubly Linked List vs GL Threads 🤼

  • Traditional Doubly Linked List: Consists of nodes with left and right pointers, and a data member pointing to application data.
  • GL Threads: Also consists of nodes (GL nodes) but only includes left and right pointers. The application data is "glued" directly to these GL nodes.

Interview Questions and Answers 🎤💡

Q1: What are the differences between a node in a traditional doubly linked list and a GL Node in GL Threads? 🛠️

Answer:
In a traditional doubly linked list, each node has left, right, and data members. The data member points to the application data. In GL Threads, a GL Node only contains left and right members, and the application data is directly attached or "glued" to the GL Node. 🤓


Q2: How does GL Threads manage to hold the application data without a dedicated data member? 🧐

Answer:
In GL Threads, the application data is tightly integrated with the GL Node. Think of it as the application data having some "sticky gum" that allows it to attach directly to the GL Node. This eliminates the need for a separate data pointer. 🍬


Q3: What is the significance of the term "glue" in GL Threads? 🤔

Answer:
The term "glue" signifies the manner in which application data is directly attached to the GL Node. The GL Node acts as the "glue" that allows the application data to stick to the thread. 🦎


Q4: How can you identify whether you are talking about a traditional node or a GL Node? 🎯

Answer:
To avoid confusion, it's common to refer to a node in a traditional doubly linked list as just "node," whereas a node in a GL Thread is specifically called a "GL Node." 🤝


Q5: What are some typical operations you can perform on GL Threads, similar to traditional doubly linked lists? 🤷‍♀️

Answer:
You can expect to perform similar operations on GL Threads as you would on traditional doubly linked lists. However, the mechanics might differ because of the "glued" nature of the application data. Examples include inserting nodes, deleting nodes, and iterating over the list. 🔄


Feel free to leverage this Q&A format for your interview prep! Best of luck, and may you "glue" all the pieces together successfully! 🍀✨