A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker. Implement the Trie class: Input [“Trie”, “insert”, “search”, “search”, “startsWith”, “insert”, “search”] [[], [“apple”], [“apple”], [“app”], [“app”], [“app”], [“app”]] Output: [null,… Continue reading
Author: Avidlearner
How TLS Works
TLS (Transport Layer Security) is a security protocol that is used to establish a secure communication channel between two systems, typically a web server and a web client (such as a web browser). Here is a high-level overview of how the TLS Handshake works:
C++ – Factory Design Pattern – Creation Design Pattern
The Factory design pattern is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created. Here’s an example of how the Factory pattern might be implemented in C++: In this example, the Product class is an interface that… Continue reading
C++ – Strategy Design Pattern – Behavioral Design Pattern
The Strategy design pattern is a behavioral design pattern that defines a family of algorithms, encapsulates each one, and makes them interchangeable. It lets the algorithm vary independently from clients that use it. Here’s an example of how the Strategy pattern might be implemented in C++: In this example, the Strategy class is an interface… Continue reading
LFU Cache Implementation – LeetCode
Design and implement a data structure for a Least Frequently Used (LFU) cache. Implement the LFUCache class: Example 1: Input [“LFUCache”, “put”, “put”, “get”, “put”, “get”, “get”, “put”, “get”, “get”, “get”] [[2], [1, 1], [2, 2], [1], [3, 3], [2], [3], [4, 4], [1], [3], [4]] Output [null, null, null, 1, null, -1, 3, null, -1, 3, 4] This… Continue reading
Difference between Windows OS and Windows Server
Operating System An operating system is a set of programs that coordinates all the activities among computer hardware devices. It provides a means for users to communicate with the computer and other software. It is a very powerful program for all the computers and similar devices like your laptops, smartphones, tablets, and your smartwatches .When… Continue reading
TLS 1.2 support with C# windows
Recently I ran into an issue where my client failed to connect to our windows software after they upgraded to TLS 1.2. Reason being our application was supporting tls version < 1.2 because of .Net 4.5 . Since TLS standards keep developing and improving. At the moment TLS 1.2 is a latest encryption standard powering… Continue reading
Calculate size of drive in C# – How to find directory drive?
In this post, we will be discussing how to find the directory drive and the size of drive in C#. This can be useful where application might want to check for drive size or remaining size of drive before getting started. Below is the snippet of implementation: To get the drive information in C#, one… Continue reading
Program to find power of a number
In computer programming, power is denoted by symbol ^ . To calculate the power y of a number x, we use x^y. For example Let’s say x = 2, y = 5 Output of x^y = 32. Below is the implementation of the same In the above program, the function pow() is used to calculate… Continue reading
Calling C++ function from C
To Call a C++ function from C , you need to use extern “C” with the C++ function and call it from your C/C++ code. The extern “C” line tells the compiler that the external information sent to the linker should use C calling conventions and name mangling. Below is the implementation: This works only for non-member… Continue reading