Skip to content

Instantly share code, notes, and snippets.

View hkasera's full-sized avatar

Harshita hkasera

View GitHub Profile
@hkasera
hkasera / Cell.js
Created June 13, 2014 16:35
A javascript code to get the excel cells array
var getCells = function (num) {
var cellArray = [];
for (var i = 0; i < num; ++i) {
cellArray.push(cellAt(i + 1));
}
return cellArray;
};
var cellAt = function (num) {
if (num <= 26) {
return String.fromCharCode(97 + num - 1);
@hkasera
hkasera / binaryTree.js
Last active August 29, 2015 14:02
Binary Tree in Javascript
var BinaryTree = function (val) {
'use strict';
this.val = val || null;
this.left = null;
this.right = null;
};
BinaryTree.prototype.create = function (num) {
'use strict';
var i;
for (i = 0; i <= num; i = i + 1) {
@hkasera
hkasera / SinglyLinkedList.js
Created June 17, 2014 18:11
Singly Linked List and related operations in javascript
var Node = function (val) {
this.val = val || null;
this.next = null;
};
var SinglyLinkedList = function () {
this.head = null;
this.tail = null;
};
@hkasera
hkasera / BST.java
Created September 5, 2015 11:03
Sorted Array to Binary Search Tree
class Node{
int val;
Node left;
Node right;
}
class Tree{
Node root;
}
@hkasera
hkasera / braceValidate.js
Created September 11, 2015 15:48
Validating a pair of braces
var a = "{{{}}}}";
var ts = [];
var mismatch = false;
for (var i = 0; i < a.length; ++i) {
if (a[i] === '{') {
ts.push('{');
}
if (a[i] === '}') {
if (ts.length == 0) {
mismatch = true;
@hkasera
hkasera / circlify.css
Last active January 4, 2016 21:59
Circlify can be used to create circular divs.
/* This makes the transition smooth.Add it globally. */
div {
-webkit-transition: all 0.3s ease-in-out 0s; /* Chrome, Safari 3.1+ */
-moz-transition: all 0.3s ease-in-out 0s; /* Firefox 3.5+ */
-ms-transition: all 0.3s ease-in-out 0s; /* IE 9 */
-o-transition: all 0.3s ease-in-out 0s; /* Opera 10.50-12.00 */
transition: all 0.3s ease-in-out 0s; /* Firefox 16+, IE 10+, Opera 12.10+ */;
}
.circular {
@hkasera
hkasera / checkPrime.js
Created January 31, 2016 11:36
JavaScript Questions
var checkPrime = function(n) {
"use strict";
if (n === 1) {
return false;
}
var isPrime = true;
for (let i = 2; i < n;) {
if (n % i === 0) {
isPrime = false;
}
@hkasera
hkasera / gist:d3cc64ffbb539621907e
Created February 5, 2016 17:38 — forked from anikalindtner/gist:9524950
Workshops/Mailinglists/Lists