#dailyDS #datastructure
На повестке дня "Связанный список" (Linked list)😑 .
Базовая структура данных, состоит из так называемых узлов, где хранятся данные и ссылок на последующие узлы.
Преимущества✔️
- Разный порядок элементов в памяти, в то время как порядок списка задается явно;
- Динамичность размера. В некоторых языках программирования при создании массива, нужно задавать его размер.
Недостатки❌
- Время доступа к элементу ленейное;
- Дополнительный расход памяти. На каждое значение прикрепляется указатель на след. узел.
p.s. следующие посты будут на английском. слишком сложные термины на русском, простите
@islombe_dev
На повестке дня "Связанный список" (Linked list)
Базовая структура данных, состоит из так называемых узлов, где хранятся данные и ссылок на последующие узлы.
Преимущества
- Разный порядок элементов в памяти, в то время как порядок списка задается явно;
- Динамичность размера. В некоторых языках программирования при создании массива, нужно задавать его размер.
Недостатки
- Время доступа к элементу ленейное;
- Дополнительный расход памяти. На каждое значение прикрепляется указатель на след. узел.
p.s. следующие посты будут на английском. слишком сложные термины на русском, простите
@islombe_dev
Please open Telegram to view this post
VIEW IN TELEGRAM
#datastructure
In the post, I wrote about linked lists. Now let's review the upgraded version of it.
Meet the Doubly Linked List😎
A doubly linked list consists of a sequence of elements, each containing two pointers. One pointer links to the previous node, and the other points to the next node. It supports the following operations: insertion, deletion, and traversal.
Pros✔️
- Badass name🖕
- Traversing in both directions🃏
- More efficient operations (delete, insert)👍
- Dynamic size💪
Cons ❌
- Extra pointers lead to more memory consumption🥰
- Time complexity is still O(n)🐌
- Implementation is harder, with more edge cases to consider😓
Use Cases
Doubly linked lists can be used when you need bidirectional traversal, such as in browser history, music playlists, blockchain, undo/redo functionality in text editors, etc.
p.s. trying to write notes by hand in digital, get used to it
In the post, I wrote about linked lists. Now let's review the upgraded version of it.
Meet the Doubly Linked List
A doubly linked list consists of a sequence of elements, each containing two pointers. One pointer links to the previous node, and the other points to the next node. It supports the following operations: insertion, deletion, and traversal.
Pros
- Badass name
- Traversing in both directions
- More efficient operations (delete, insert)
- Dynamic size
Cons ❌
- Extra pointers lead to more memory consumption
- Time complexity is still O(n)
- Implementation is harder, with more edge cases to consider
Use Cases
Doubly linked lists can be used when you need bidirectional traversal, such as in browser history, music playlists, blockchain, undo/redo functionality in text editors, etc.
p.s. trying to write notes by hand in digital, get used to it
Please open Telegram to view this post
VIEW IN TELEGRAM
#datastructure
Queue Data Structure🏃♀️
A queue is a linear data structure that follows the First In, First Out (FIFO) principle. This means that the first element added to the queue will be the first one to be removed.
Key Operations
- Enqueue: Add an element to the end of the queue.
- Dequeue: Remove an element from the front of the queue.
- Front: Access the first element without removing it.
- IsEmpty: Check if the queue is empty.
- Size: Get the number of elements in the queue.
Applications of Queues
- Task Scheduling: Manage tasks in operating systems.
- Print Queue: Manage print jobs in printers.
- Breadth-First Search (BFS): Traverse graphs and trees level-by-level.
- Message Queuing: Handle communication between processes or systems.
Queues provide a simple and effective way to manage ordered data. They are essential for scenarios where the order of operations must be preserved, such as task scheduling and data streaming.
@islombe_dev
Queue Data Structure
A queue is a linear data structure that follows the First In, First Out (FIFO) principle. This means that the first element added to the queue will be the first one to be removed.
Key Operations
- Enqueue: Add an element to the end of the queue.
- Dequeue: Remove an element from the front of the queue.
- Front: Access the first element without removing it.
- IsEmpty: Check if the queue is empty.
- Size: Get the number of elements in the queue.
Applications of Queues
- Task Scheduling: Manage tasks in operating systems.
- Print Queue: Manage print jobs in printers.
- Breadth-First Search (BFS): Traverse graphs and trees level-by-level.
- Message Queuing: Handle communication between processes or systems.
Queues provide a simple and effective way to manage ordered data. They are essential for scenarios where the order of operations must be preserved, such as task scheduling and data streaming.
@islombe_dev
Please open Telegram to view this post
VIEW IN TELEGRAM