animate div

Js interview

https://career.guru99.com/top-85-javascript-interview-questions/ Problem

Answer This will actually log “1 3 2”, since the “2” is on a setTimeout which will only execute, by this example, after two seconds. Your application does not hang waiting for the two seconds to finish. Instead it keeps executing the rest of the code and when the timeout is finished […]

shellsort (js)

Shellsort is the same as insertion sort. Except that it uses a pass array to decide how many number of steps to jump. In Insertion Sort, we always use 1 step. When we backtrack, we go back 1 step. But in Shellsort, we have an array, where we decide how many jumps to backtrack. This […]

Circular List in JS (prototype pattern, constructor pattern)

Prototype Pattern – Using prototypes to create classes, all instances of that class will the same functions. – Can’t have private utility functions. All properties and functionalities can be seen by caller.

Constructor Pattern with scoped private variables By using scoped variables, we can have privacy, and can create get/set functionalities for public access. […]

Immediately-Invoked Function Expression

https://stackoverflow.com/questions/8228281/what-is-the-function-construct-in-javascript The first pair of parentheses (function(){…}) turns the code within (in this case, a function) into an expression. second pair of parentheses (function(){…})() calls the function that results from that evaluated expression.

The function is executed right after it’s created, not after it is parsed. The entire script block is parsed before any […]

swift to dos

Swift TODO: Course Goal: Adding source files, resources, links, and literals Adding pages to a playground Using overflow operators and bitwise operators Using ranges with strings Creating complex sequences Chaining higher-order functions Defining lazy properties Using failable initializers Mutating methods Working with singletons Nesting function types Creating error types and recursive enumerations Extending concrete types […]

Insertion Sort

http://www.geeksforgeeks.org/insertion-sort/ Insertion sort is a simple sorting algorithm that works the way we sort playing cards in our hands Given, 8 5 3 12 2 For the first pass, we always start at index 1. So we see 5 and store it in variable valueToInsert. There are 2 conditions we must satisfy: 1) 1 > […]