Tutorial by Examples: bst

Here is an example of an Azure Powershell automation runbook that deletes any blobs in an Azure storage container that are older than a number of days. This may be useful for removing old SQL backups to save cost and space. It takes a number of parameters which are self explanatory. Note: I have ...
ghci> :set -XOverloadedStrings ghci> import Data.Text as T isInfixOf :: Text -> Text -> Bool checks whether a Text is contained anywhere within another Text. ghci> "rum" `T.isInfixOf` "crumble" True isPrefixOf :: Text -> Text -> Bool checks whether a...
Abstraction is one of the main concepts in Object Oriented Programming (OOP). This is the process of hiding the implementation details for the outsiders while showing only essential details. In another words, Abstraction is a technique to arrange the complexity of a program. There are two basic typ...
Patterns can be used to replace part of an input string. The example below replaces the cent symbol with the dollar symbol. var money = "¢¥€£$¥€£¢" let pattern = "¢" do { let regEx = try NSRegularExpression (pattern: pattern, options: []) let nsString = money as NSS...
You can convert tabs to spaces by doing the following: First check that expandtab is switched off :set noexpandtab Then :retab! which replaces spaces of a certain length with tabs If you enable expandtab again :set expandtab then and run the :retab! command then all the tabs becomes spaces...
Let's say we have the following 4 by 4 grid: Let's assume that this is a maze. There are no walls/obstacles, though. We only have a starting point (the green square), and an ending point (the red square). Let's also assume that in order to get from green to red, we cannot move diagonally. So, s...
Let's say we have the following 4 by 4 grid: Let's assume that this is a maze. There are no walls/obstacles, though. We only have a starting point (the green square), and an ending point (the red square). Let's also assume that in order to get from green to red, we cannot move diagonally. So, s...
var providerName = "System.Data.SqlClient"; //Oracle.ManagedDataAccess.Client, IBM.Data.DB2 var connectionString = "{your-connection-string}"; //you will probably get the above two values in the ConnectionStringSettings object from .config file var factory = DbProviderFac...
Consider the BST: Lowest common ancestor of 22 and 26 is 24 Lowest common ancestor of 26 and 49 is 46 Lowest common ancestor of 22 and 24 is 24 Binary search tree property can be used for finding nodes lowest ancestor Psuedo code: lowestCommonAncestor(root,node1, node2){ if(root == NULL) ...
Create a Node.js debug configuration and use index.js as Node parameters.
Add this script to your package.json: "start:idea": "ts-node %NODE_DEBUG_OPTION% --ignore false index.ts", Right click on the script and select Create 'test:idea'... and confirm with 'OK' to create the debug configuration: Start the debugger using this configuration:
public abstract class BaseActivity extends AppCompatActivity { private Map<Integer, PermissionCallback> permissionCallbackMap = new HashMap<>(); @Override protected void onStart() { super.onStart(); ... } @Override public void setConten...
iex(1)> String.contains? "elixir of life", "of" true iex(2)> String.contains? "elixir of life", ["life", "death"] true iex(3)> String.contains? "elixir of life", ["venus", "mercury"] false
A binary tree is BST if it satisfies any one of the following condition: It is empty It has no subtrees For every node x in the tree all the keys (if any) in the left sub tree must be less than key(x) and all the keys (if any) in the right sub tree must be greater than key(x). So a straightf...
Why to use LSP Scenario: Suppose we have 3 databases (Mortgage Customers, Current Accounts Customers and Savings Account Customers) that provide customer data and we need customer details for given customer's last name. Now we may get more than 1 customer detail from those 3 databases against giv...
One of the most common and useful ways to replace text with regex is by using Capture Groups. Or even a Named Capture Group, as a reference to store, or replace the data. There are two terms pretty look alike in regex's docs, so it may be important to never mix-up Substitutions (i.e. $1) with Back...
Given 2 string str1 and str2 we have to find the length of the longest common substring between them. Examples Input : X = "abcdxyz", y = "xyzabcd" Output : 4 The longest common substring is "abcd" and is of length 4. Input : X = "zxabcdezy", y = "y...
Abstract Method declared without an implementation C++ pure virtual method virtual void eat(void) = 0; Java abstract method abstract void draw(); Abstract Class cannot be instantiated C++ cannot be instantiated; has at least 1 pure virtual method class AB {public: virtual void f() = ...

Page 5 of 5