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 · 4 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 · 9 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 · 9 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 ($n$). 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 given the size of its input but it does not consider other characteristics of the input that could affect its runtime. ...

September 22, 2023 · 9 min · Avnish

REST API Requests in Go

What is REST? REST (REpresentational State Transfer) is an architectural style for designing and developing APIs that could be used for client and server interactions. REST defines 6 architectural constraints for APIs: Uniform interface: API requests for a resource should look the same irrespective of its origin client. The Uniform Resource Identifier (URI) allocated to resources should be unique. Client-server: Changes on the client side should not affect the server and vice-versa. Stateless: The API request should contain all the resources required to process it. The server should not store any details related to client requests. Cacheable: API Responses could be cached on the client or server side. Layered system: Neither the client nor the server should have information regarding the number of intermediate layers during communication. Code on demand (optional): When required, code snippets sent through API responses should be executable on demand. APIs that comply with REST architecture constraints are called RESTful APIs. ...

September 15, 2023 · 8 min · Avnish

Concurrency in Go

We can make a program concurrent if we can split it as multiple independent tasks executed at the same time. In concurrency, we execute different portions of a program at the same time (on single or multiple CPU threads) whereas in parallelism a singular task (or subtasks) is executed parallelly on multiple CPU threads. Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once. ...

September 12, 2023 · 10 min · Avnish

File Handling in Go

Reading and writing files is one of the most common tasks in programming projects. Using this skill we can store data persistently and decrease the memory consumption of our program. Paths The path/filepath package provides filepath.Join() function to create filesystem paths for files and directories. The same could also be achieved with string concatenation in Go but it won’t be interoperable between different operating systems (Linux uses the forward slash (/) for separators in the path whereas Windows uses the backward slash (\)). ...

June 27, 2023 · 12 min · Avnish

Go Programming Language

Go is a compiled language developed by Robert Griesemer, Rob Pike, and Ken Thompson at Google. It is primarily used in cloud-native and web development projects. Some of the popular projects created with Go Docker: Container Engine Kubernetes: Container Orchestrator Hugo: Static Site Generator (Also used to generate this blog) Helm: Package manager for Kubernetes Packages A Package abstraction is created in Go to group functions that are related to each other or associated with a specific task. At the start of each source file (*.go) a package name is assigned to it using the package keyword, for example, package main. ...

June 21, 2023 · 20 min · Avnish

Network Functions

Telcos (Telecommunication companies) deploy networks that have high availability, are scalable, and resilient covering entire countries. Components like routers, firewalls, and DHCP servers (called Network Functions) are the building blocks of such large network deployments. Traditionally, network functions were deployed on proprietary hardware with application-specific integrated circuits and installed on the telco’s premise (baremetal deployment). Such network functions are called Platform Network Functions (PNFs). PNF deployments present the following challenges: ...

June 7, 2023 · 6 min · Avnish
Lifecycle of a volume managed by CSI Plugin

Container Storage Interfaces (CSI)

There is a multitude of choices for storage solutions (Amazon S3, Ceph, Google Cloud Storage, etc.) and combined with the choices of container orchestrators (Kubernetes, Apache Mesos, Docker Swarm, etc.) the permutations are endless. A Container Storage Interface (CSI) plugin is implemented by the storage providers (Amazon, Google, IBM) as an interface to provision and mount volumes for workloads when requested by container orchestrators. The CSI plugin provisions the volume, procures it from the node hosting the container, and mounts it to the requesting container. It standardizes the process of allocating storage for containers between different orchestrators. ...

May 31, 2023 · 6 min · Avnish