Skip to content

Instantly share code, notes, and snippets.

Praveen Kajla praveenKajla

  • Jaipur, India
Block or report user

Report or block praveenKajla

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ReadME.md

This Documentation is recieved as an artifact of utmost importance from the desert of the dead.

Humanity is almost dead and machines rule the world and they grow humans and use them as a source for their power. But don't lose the hope. Our Hero Neo is alive and is here to help you. Neo in collabration with Morpheus have built two applications / ...
/
/
Kliento Leseva to keep the humans of planet pocket aces free from any rival machines and to come up with new ideas.

View intersection.js
//Write a function to get the intersection point of two Linked Lists.
function intersection(ll1,ll2){
let c1 = ll1.length()
let c2 = ll2.length()
let d = Math.abs(c1-c2)
if(c1>c2){
return getIntersection(d,ll1.head,ll2.head)
}else{
return getIntersection(d,ll2.head,ll1.head)
}
@praveenKajla
praveenKajla / algo.md
Last active Oct 21, 2017
Given an array of integers, sort the array according to frequency of elements.
View algo.md

-- create BST with freq property updated if duplicate is inserted

-- do inorder traversal and store the data and freq of each node in an auxiliary array count => [{data:data,freq:freq}]

-- sort the count array with descending frequency

-- traverse the array and print every data element in count count[i].freq times

@praveenKajla
praveenKajla / minHeap.js
Created Oct 20, 2017
Minimum heap in Javascript => es6
View minHeap.js
class minHeap{
constructor(capacity){
this.heapSize = -1;
this.heap = Array(capacity).fill(-1)
}
insert(value){
if(this.heapSize+1==this.heap.length){
throw "Overflow Size"
}
this.heap[this.heapSize+1] = value
@praveenKajla
praveenKajla / equal0and1Subarray.js
Created Oct 20, 2017
Largest subarray with equal number of 0s and 1s => es6
View equal0and1Subarray.js
//Largest subarray with equal number of 0s and 1s//
//Pass 1
var assert = require('assert')
function pass1(arr=[]){
let n = arr.length,maxLength = -1,sum=0,start
for(let i=0;i<n-1;i++){
sum = (arr[i]==0) ? -1 : 1
for(let j=i+1;j<n;j++){
View AVLTree.js
class Node{
constructor(d){
this.key = d;
this.height = 1
this.left = null
this.right = null
}
}
@praveenKajla
praveenKajla / leftArrayRotate.js
Last active Oct 15, 2017
Write a function rotate(ar[], d, n) that rotates arr[] of size n by d element
View leftArrayRotate.js
//Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements
//https://www.youtube.com/watch?v=utE_1ppU5DY
//pass 1
//1.copy first d elements in temp array
//2.move original array forward by d
//3.start updating vlues in originl array from n-d th position
// time complexity n space complexity d
function rotate1(arr=[],d){
let n = arr.length
let temp = []
View convertedCurrying.js
"use strict";
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var log = console.log;
function example(a, b, c) {
log({ a: a, b: b, c: c });
return a * b * c;
}
View CompanionObject.kt
class Log(){
companion object Factory{
@JvmStatic fun createFileLog(filename: String):Log = Log(filename)
//we can access this static function from java using @JvmStatic as Log.createFileLog("File.txt")
}
//second companion object not possible
constructor(filename:String):this(){}
You can’t perform that action at this time.