The isAnagram function will return true if both input strings are anagram and false otherwise

Identify Anagrams

Problem Statement We have to implement an isAnagram() function that takes two strings as input and returns true if they both are anagrams and false otherwise. Multiple words could be anagrams of each other if they contain the same characters with the same frequency of occurrence. For word counter: trounce is an anagram. trouncee isn’t an anagram, because the character e appears twice in trouncee. tounce isn’t an anagram, because the character r is missing....

October 12, 2023 · 5 min · Avnish
The containsDuplicate function takes an array as input and returns true or false depending on the fact that array contains duplicate elements or not

Checking an Array for Duplicate Values

Problem Statement We have to implement a function containsDuplicate() that takes an integer array as input and returns true if an element occurs more than once and false otherwise. Brute Force Solution The simplest solution for this problem would be two nested loops, where the first loop will select an element and the second loop will select another element from the array and compare them. On the first occurrence of a duplicate element, the function will exit while returning true....

October 10, 2023 · 3 min · Avnish
Rabin-Karp Substring Search

Rabin-Karp Substring Search

Searching contents on a website for a specific keyword, code search in text editors & IDEs, and information retrieval systems used in libraries and archives are use cases for an algorithm that searches a string within another string. Unlike searching for a single character, searching for a complete string could be challenging. If we search string ION in DICTIONARY. For each character in DICTIONARY, we have to look for I, O, and N in the same order....

October 8, 2023 · 8 min · Avnish
Arrays, Strings, and HashMaps

Arrays, Strings, and HashMaps

Data structures like arrays, strings, and hashmaps are available by default in most programming languages. They facilitate storage of large amounts of data in an efficient format which makes it easier (and sometimes relatively faster) to access during runtime. Arrays An array is a sequential store of data (referred to as elements). In languages like Python, an array can store elements with multiple data types, like, [1, "Hello, World", True] but for languages like Go, C++, and Java an array can store elements of a singular data type....

September 29, 2023 · 8 min · Avnish
Time Complexity Comparison of Algorithms

Time Complexity

While programming allows us to create virtually anything, the true test of performance arises when we deploy the same code on a significantly larger scale. Time Complexity ($T(n)$) is a function that estimates the execution time of an algorithm given the amount of data to be processed as its input. It is a common benchmark used to measure an algorithm’s performance. Bounds of Time Complexity The output of the time complexity function will be a close estimate of an algorithm’s runtime yet it does not consider other characteristics of the data that could affect runtime....

September 22, 2023 · 8 min · Avnish