DSA - Backtracking

What is Backtracking? Backtracking is a class of algorithms for finding solutions to complex problems. A backtracking algorithm uses recursion and is based on depth-first search (DFS). Depth First Search (DFS) Depth First Search (DFS) is an essential part of backtracking. DFS is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (or an arbitrary node in the case of a graph) and explores as far as possible along each branch before backtracking....

September 9, 2024 · 1 min · Dmytro Chumakov

DSA - Trie

What is a Trie? A Trie is a data structure usually called a “prefix tree,” often represented as a nested tree of dictionaries where each key is a character that maps to the next character in a word. Let’s look at some examples of a Trie. The Trie consists of two main classes: the TrieNode class and the Trie class. TrieNode The TrieNode class has two properties: children - a property that represents all characters in a given word and points to the next character....

September 6, 2024 · 2 min · Dmytro Chumakov

DSA - Binary Search Tree

What is a Tree? A Tree is a data structure that has a root and subtrees of children, representing a set of linked nodes. Trees behave similarly to a LinkedList in that they have a collection of nodes starting with a head (root). The main difference is that Trees can have multiple children, whereas a LinkedList, on the other hand, can have only one next child. I’m going to focus on a commonly used type of tree, the Binary Search Tree....

September 2, 2024 · 3 min · Dmytro Chumakov

DSA - Sliding Window

What is the sliding window technique? The sliding window technique is a common algorithmic approach used to create a fixed-sized window that moves through the data one step at a time, typically from left to right, to perform specific operations or computations on the elements within the window. What is the sliding window algorithm? The sliding window algorithm is a method for finding a subset of elements that satisfy certain conditions in a given problem....

August 28, 2024 · 2 min · Dmytro Chumakov

DSA - Linked List

What is a Linked List? A linked list is a common data structure that is similar to an array, but its order is based on pointers to the next element in memory instead of using physical placement (indices). A linked list has two main components: ListNode class: This class has a val property that represents the value and a next property that represents a pointer to the next element in memory....

August 27, 2024 · 2 min · Dmytro Chumakov