Skip to content

Latest commit

 

History

History
109 lines (61 loc) · 3.75 KB

File metadata and controls

109 lines (61 loc) · 3.75 KB

📚 GL Threads - Understanding Glued Version of Doubly Linked Lists

📌 Introduction

🎯 Objective

GL Threads are a glued version of traditional doubly linked lists, designed to reorganize data structures in a more efficient way.


🔄 Traditional Doubly Linked Lists vs GL Threads

💡 Recap of Traditional Doubly Linked Lists

  • 🏷 Node Structure: A typical node of a traditional doubly linked list has three members - left, right, and data.
  • 📚 List Structure: Represents the doubly linked list itself.

🆕 Introduction to GL Threads

  • 🏷 Node Structure: Contains only left and right members, no data.
  • 📚 List Structure: Has a pointer to the head of the thread and also has a unique offset member.

🤔 What's Missing in GL Threads?

❌ Absence of data Member

  • In traditional nodes, the data member points to application data.
  • This data member is not present in GL Thread nodes.

📊 Features of GL Threads

⚙ Functional Pointers

  • Like traditional lists, GL Threads can also have function pointers.

📏 Offset Member

  • A unique feature in GL Threads is the offset member

Revision Notes on GL Threads vs Traditional Doubly Linked Lists 📘

Introduction 🌟

This document focuses on understanding the differences between GL Threads and traditional doubly linked lists. It's tailored to prepare you for interviews that might ask questions related to this topic.


Concept Overview 🌐

What are GL Threads? 🤔

  • GL Threads are a "glued" version of traditional doubly linked lists.
  • They serve the same purpose as traditional doubly linked lists but are organized differently for efficiency.

Structures in Traditional Doubly Linked List and GL Threads 🛠️

Traditional Doubly Linked List 📚

  • Node structure: Contains three members left, right, and data.
  • List structure: Usually contains a head pointer.

GL Threads 📚

  • GL Node structure: Contains only two members left and right.
  • Thread structure: Similar to the traditional structure but adds an offset member.

Interview Questions and Answers 🎤💡

Q1: What is the purpose of GL Threads? 🎯

Answer: The purpose of GL Threads is the same as traditional doubly linked lists, which is to organize data efficiently. However, GL Threads are designed to do this in a more efficient way than traditional doubly linked lists.


Q2: Can you explain the structural difference between a node in a traditional doubly linked list and a node in GL Threads? 🏗️

Answer: In a traditional doubly linked list, each node has three members: left, right, and data, where data is a pointer to the application data. In GL Threads, the node (known as GL Node) only has two members: left and right. There is no data member in GL Nodes.


Q3: What is the role of the offset member in GL Threads? 🤷‍♀️

Answer: The offset member is unique to GL Threads and serves a specific purpose in how GL Threads manage data.


Q4: How do GL Threads hold application data if there is no data member? 📦

Answer: GL Threads are designed in such a way that they don't need a separate data member to hold the application data. The data is directly integrated into the structure of the GL Threads, making it more memory efficient.


Q5: Can you have function pointers in GL Threads, similar to traditional doubly linked lists? 🖱️

Answer: Yes, like traditional doubly linked lists, GL Threads can also have function pointers. This allows for a similar level of extensibility and functionality.


Feel free to use these notes and Q&A to prepare for your upcoming interviews! Good luck! 🍀✨