What is a Linked List? A linked list is a linear data structure composed of nodes, each of which holds a value and a reference (or pointer) to the next node in the list. The first node is referred to as the list’s head, while the last node is referred to as the list’s tail. […]
May 14, 2023 | Data Structure | No comments
What is Recursion? In computer science, recursion is a strong programming technique that is used in many algorithms and data structures. In the context of data structures and algorithms, recursion refers to a function calling itself to solve a problem or conduct a computation, either directly or indirectly. Working & usage of Recursion in DSA: […]
May 13, 2023 | Data Structure | No comments
What is Collision in Hashing? In hashing, collisions occur when two or more keys yield the same hash value or hash code. Collisions are unavoidable because hash algorithms transfer a theoretically unlimited collection of keys to a finite range of hash results. We have certain collision strategies that we can use to resolve these problems. […]
May 12, 2023 | Data Structure | No comments
What is Hashing? Hashing is a computer science technique for mapping arbitrary-size input to a fixed-size result. A Hash table is a data structure that stores some information, and the information has basically two main components, i.e., key and value. Cryptography, data indexing, data retrieval, and checksum creation are among applications that employ hash functions. […]
May 6, 2023 | Data Structure | No comments
In the previous post, we got an introduction to Strings and their methods. Let us now take a look at a few problems related to it. Given a string s, return the longest palindromic substring in s. Example: Input: s = “babad” Output: “bab” Explanation: “aba” is also a valid answer. Solution: Time complexity: O(n^3), where n is the length […]
May 3, 2023 | Data Structure | No comments
What is a String? A string is a character sequence in computer science. It’s one of the most used data types in programming, and it’s used to represent text like names, addresses, and messages. Storage: A string is normally stored in memory as a contiguous block of memory holding the character sequence. Depending on the […]
May 2, 2023 | Data Structure | No comments
What is Bucket Sort? Bucket Sort is a sorting method that divides an array into tiny buckets before sorting the elements within each bucket separately using another sorting algorithm, often insertion sort. It is mainly useful when input is uniformly distributed over a range. Algorithm: The algorithm for bucket sort is as follows: Create a […]
May 2, 2023 | Data Structure | No comments
What is Radix Sort? Radix sort is an integer-based linear sorting method that groups items depending on their location or radix. It sorts the components in each iteration by the value of the digit at the current place, from least significant to most significant. Algorithm: The steps involved in radix sort are: Find the maximum […]
May 1, 2023 | Data Structure | No comments
What is Heap Sort? Heap sort is a sorting method that works by first constructing a binary heap from the array to be sorted, then removing the maximum element from the heap and inserting it at the end of the array. Algorithm: The basic steps of the Heap Sort algorithm are as follows: Build a […]
April 29, 2023 | Data Structure | No comments
What is Merge Sort? Merge sort is a divide-and-conquer method that sorts an array by splitting it into half recursively until the subarrays are of size 1 or 0, then merging them back together in sorted order. The main notion underlying this technique is that merging two sorted arrays is substantially easier than sorting an […]
April 28, 2023 | Data Structure | No comments