Skip to content

Instantly share code, notes, and snippets.

View amkhrjee's full-sized avatar

Aniruddha Mukherjee amkhrjee

View GitHub Profile
@amkhrjee
amkhrjee / REST.md
Created January 1, 2022 13:08
Basic terms related to REST and the web

What is REST?

Representational state transfer (REST) is a software architectural style that was created to guide the design and development of the architecture for the World Wide Web.

REST has been employed throughout the software industry and is a widely accepted set of guidelines for creating stateless, reliable web APIs. A web API that obeys the REST constraints is informally described as RESTful. RESTful web APIs are typically loosely based on HTTP methods to access resources via URL-encoded parameters and the use of JSON or XML to transmit data.

But what is an URL?

A Uniform Resource Locator (URL), colloquially termed a web address,[1] is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI),[2][3] although many people use the two terms interchangeably.[4][a] URLs occur most commonly to reference web pages (http) but are also used for file transfer (ftp), email (mailto), d

How the internet works?

The internet is an infrastructure, whereas the Web is a service buit on top of that. And it is worth noting that there are several other services that are built on top of the internet, for example IRC and email.

Think of several computers - all connected to each other - having access to each other's data. The infrastructure (think of the internet cables, modem, ISPs, routers) that enables this is called the 'internet'.

HTTP - Hyper Text Transfer Protocol

HTTP is an application level protocol - but what does that mean?

HTTP itself runs on top of other protocols. When connecting to a web site, for example at www.example.org, the user agent is using the TCP/IP suite of protocols. The TCP/IP model was designed in 1970 with 4 distinct layers:

What is the difference between webpage, website, web server, and search engine?

Primary definitions

Web Page

A document which can be displayed in a web browser such as Firefox, Google Chrome, Opera, Microsoft Internet Explorer or Edge, or Apple's Safari. These are also often called just "pages."

Website

A collection of web pages which are grouped together and usually connected together in various ways. Often called a "web site" or a "site."

Web Server

Understanding margin: auto;

margin-left: auto; puts all the margin available to the left side of the element and pushes the element to the far right. margin-right: auto; puts all the margin available to the right side of the element and pushes the element to the far left. margin-right: auto; margin-left: auto; centers the element horizontally within that space.

Same rules apply for margin-bottom and margin-top.

Resources

Understanding flex-basis, flex-grow & flex-shrink

flex-grow

When we have extra space, how should we distribute it to the different elements of the flexbox?

flex-shrink

Exactly opposite of flex-grow

flex-basis

How much should be the height and width of flex elements, ideally.

Resources

using System;
class Program
{
public static void Main()
{
int[] arr = { 40, 67, 34, 25, 65, 87, 23 };
//insertion sort
using System;
class Program
{
public static void Main()
{
int[] arr = { 40, 67, 34, 25, 65, 87, 23, 100, 8, 45, 69 };
void insertionSort(int[] arr)
{
@amkhrjee
amkhrjee / MergeSortSentinels.cs
Created January 11, 2022 09:43
Merge Sort using sentinels
using System;
class Test
{
public static void Main()
{
{
int[] arr = { 30, 40, 50, 10, 20 };
void MergeSort(int[] arr, int lowerIndex, int upperIndex)
{
@amkhrjee
amkhrjee / MergeSortWithBinarySearch.cs
Created January 11, 2022 09:50
Solution to problem 2.3.7 CLRS
using System;
class Program
{
public static void Main()
{
int[] arr = { 30, 40, 50, 10, 20 };
int res = 6;
void MergeSort(int[] arr, int lowerIndex, int upperIndex)
using System;
class Program
{
public static void Main()
{
int[] arr = { 2, 3, 8, 6, 1 };
int inversionCounter(int[] arr, int lowerIndex, int upperIndex)
{