coderz.py

Keep Coding Keep Cheering!

DSA: Hashing

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

Problems based on Strings

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

DSA: Strings Concept

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

Bucket Sort

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

Radix Sort

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

Heap Sort

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

Merge Sort

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

Quick Sort

What is Quick Sort? Quick sort is a common sorting algorithm that sorts an array using the divide-and-conquer technique. Quick sort works by selecting a pivot element, partitioning the array around the pivot element, and recursively sorting the sub-arrays. Algorithm: The basic steps of the Quick sort algorithm are as follows: Choose one of the […]

April 27, 2023 | Data Structure | No comments

Insertion Sort

What is Insertion Sort? Insertion sort is a straightforward sorting algorithm that constructs the final sorted array one item at a time. It operates by splitting the input array into two parts: sorted and unsorted. The method then continually inserts the first unsorted element into the right location in the sorted section, moving the remaining […]

April 26, 2023 | Data Structure | No comments

Selection Sort

What is Selection Sort? Selection sort is a sorting method that finds the smallest element in an unsorted region of an array and places it at the beginning of the array. In the provided array, the method keeps two subarrays: The subarray that has previously been sorted The remaining unsorted subarray Algorithm: Algorithm for Selection […]

April 26, 2023 | Data Structure | No comments

Advertisement