Tag: Data Structures and Algorithms

LRU Cache
What Is LRU Cache? A cache is a hardware or software component, that stores data so that future retrieval requests can be executed quickly. Each cache operates according to a specific strategy that determines which data is supposed to be stored. One of these cache strategies is the Least Recently Used cache, or LRU cache. […]

Topological Sorting and Cycle Detection
Topological Sorting Topological sorting arranges the nodes which belong to a directed acyclic graph (DAG) in a linear order so that for every edge from \(v_i\) to \(v_j\) , \(v_i\) appears before \(v_j\). There’re two wellknown algorithms to execute topological sorting: DepthFirst Search (DFS) approach, and Kahn’s algorithm. Topological sorting: DFS approach In DFS approach, […]

Stacks and Queues
Stacks What Is Stack? A stack is a data structure in which we can only access the element that was added last, and this access follows lastinfirstout (LIFO) principle. Stacks, for instance, can be used to implement a redo and undo function, and a backtracking algorithm (such as depthfirst search, DFS). Implementations Stacks typically support […]

Trees and Graphs
Trees What Is a Tree? A tree is a data structure similar to a linked list. While in a linked list, each node can link to only one other node, in a tree, each node can link to multiple other nodes, which are called child nodes or just children. Additionally, a tree must satisfy the […]

Lists, Arrays and Strings
Linked Lists What Is Linked List? A linked list is a data structure that stores elements, or nodes, in a linear order. Nodes in a linked list, have both data and only one pointer to the next node. They are called as singly linked lists. In some linked lists, nodes also have another pointer to […]

Time Complexity
What Is Time Complexity? Time complexity, or Big O notation, is one way describing how the time it takes to execute your function grows as the size of the input increases. In other words, this is a simplified analysis of an algorithm’s efficiency; it is independent from the machine algorithms run on because it only […]