Skip to content

Instantly share code, notes, and snippets.

View deadcoder0904's full-sized avatar
:octocat:
Dead

akshay kadam (a2k) deadcoder0904

:octocat:
Dead
View GitHub Profile
@deadcoder0904
deadcoder0904 / recursive-circularly-rotated-array.cpp
Created September 9, 2016 07:36
Application of Binary Search - Circularly Rotated Array
#include<bits/stdc++.h>
#define min(x,y) x<y?x:y
using namespace std;
int min_index(int a[],int n){
int low=0,high=n-1;
while(low<=high){
if(a[low]<=a[high])
@deadcoder0904
deadcoder0904 / sorting_theory.txt
Created September 18, 2016 15:57
Sorting Algorithms Theory
Sorting is a key to CS theory, but easy to forget. I had an itch to review the algorithms in Wikipedia (strange, I know), and here are my notes:
High-level thoughts
Some algorithms (selection, bubble, heapsort) work by moving elements to their final position, one at a time. You sort an array of size N, put 1 item in place, and continue sorting an array of size N – 1 (heapsort is slightly different).
Some algorithms (insertion, quicksort, counting, radix) put items into a temporary position, close(r) to their final position. You rescan, moving items closer to the final position with each iteration.
One technique is to start with a “sorted list” of one element, and merge unsorted items into it, one at a time.
Complexity and running time
Factors: algorithmic complexity, startup costs, additional space requirements, use of recursion (function calls are expensive and eat stack space), worst-case behavior, assumptions about input data, caching, and behavior on already-sorted or nearly-sorted data
Worst-case behav
@deadcoder0904
deadcoder0904 / classification_of_algorithms
Created September 18, 2016 16:00
Classification of Algorithms
Classification of Algorithms
Contents
Classification by purpose
By implementation
By design paradigm
By complexity
Classification by purpose
@deadcoder0904
deadcoder0904 / algorithmic_parameters.txt
Created September 18, 2016 18:49
Parameters for Algorithms
PARAMETERS FOR ALGORITHMS
(1) Time Complexity -
Asymptotic Analysis
(2) Space Complexity or Memory Usage -
(a) In Place ( Constant Memory )
@deadcoder0904
deadcoder0904 / elements_innertext.js
Created September 30, 2016 08:24
Select All Elements InnerText Using Pure Javascript
var spans = document.querySelectorAll('element');
obj = [];
for(var i = 0, l = spans.length; i < l; i++){
obj.push(spans[i].textContent || spans[i].innerText);
}
@deadcoder0904
deadcoder0904 / virtual_env.txt
Created October 14, 2016 18:41
Install 3rd Party modules in Python( Ubuntu )
There are three ways to install Python libraries:
(1) Use apt-get, aptitude or similar utilities.
(2) Use easy_install or pip (install pip first, its not available by default)
(3) If you download some .tar.gz file, unzip it and then type sudo python setup.py install
Manually messing with paths and moving files around is the first step to headaches later. Do not do it.
For completeness I should mention the portable, isolated way; that is to create your own virtual environment for Python.
(1) Run sudo apt-get install python-virtualenv
@deadcoder0904
deadcoder0904 / samba.md
Last active November 10, 2016 16:26
Enabling Samba Service to connect to Ubuntu using ES File Explorer in Android

Trick samba into thinking that every remote user is you ( at least as far as that share is concerned ) by doing something like this:

Press Alt+F2 & Type this in Terminal

sudo gedit /etc/samba/smb.conf

In the [global] section add the following line:

force user = bob

@deadcoder0904
deadcoder0904 / wifi-not-working.md
Last active November 10, 2016 16:30
Ubuntu WiFi not working after Installation

You need to install wireless driver.

Insert your Ubuntu installation disk or a flash drive and copy these files from the installation disk to your Home directory:

pool/main/d/dkms/dkms_XXXXX.deb

pool/restricted/b/bcmwl/bcmwl-kernel-source_XXXXX.deb

Then run the following in terminal:

@deadcoder0904
deadcoder0904 / fp-light.md
Last active January 6, 2017 19:35
Functional Light JS Notes

Functional Light JS Notes

(1) Morphism - A fancy way of describing a set of values that maps to another set of values

(2) Function vs Procedure -Functions take input & return some ouptut; Procedures need not return

(3) Arity - Arity is the number of parameters in a function declaration.

(4) Unary Function - A function with arity of 1 is also referred to as a unary function.