Skip to content

Instantly share code, notes, and snippets.

View S-codes14's full-sized avatar
:octocat:
opensource != charity

S-codes14 S-codes14

:octocat:
opensource != charity
View GitHub Profile
@S-codes14
S-codes14 / Hashtable.js
Created May 22, 2021 04:12
Hash table in js
/* Hash Table */
var hash = (string, max) => {
var hash = 0;
for (var i = 0; i < string.length; i++) {
hash += string.charCodeAt(i);
}
return hash % max;
};
@S-codes14
S-codes14 / binarySearchTree2.js
Created May 22, 2021 04:10
Binary Search Tree: Traversal & Height
/* Binary Search Tree */
class Node {
constructor(data, left = null, right = null) {
this.data = data;
this.left = left;
this.right = right;
}
}
@S-codes14
S-codes14 / binarySearchTree.js
Created May 22, 2021 04:08
binary search tree implemented in javascript
/* Binary Search Tree */
class Node {
constructor(data, left = null, right = null) {
this.data = data;
this.left = left;
this.right = right;
}
}
@S-codes14
S-codes14 / queue.js
Created May 22, 2021 04:06
queue in javascript
/* Queues */
function Queue () {
collection = [];
this.print = function() {
console.log(collection);
};
this.enqueue = function(element) {
collection.push(element);
};
@S-codes14
S-codes14 / Sets.js
Created May 22, 2021 04:03
Sets in javascript
/* Sets */
function mySet() {
// the var collection will hold the set
var collection = [];
// this method will check for the presence of an element and return true or false
this.has = function(element) {
return (collection.indexOf(element) !== -1);
};
// this method will return all the values in the set
@S-codes14
S-codes14 / stacks.js
Created May 22, 2021 03:59
stack algorithm
/* Sets */
function mySet() {
// the var collection will hold the set
var collection = [];
// this method will check for the presence of an element and return true or false
this.has = function(element) {
return (collection.indexOf(element) !== -1);
};
// this method will return all the values in the set
@S-codes14
S-codes14 / arrayfunctions.js
Created May 22, 2021 00:08
some of the very powerful higher order functions and working with arrays. We will look at forEach, map, filter, reduce and sort.
const companies= [
{name: "Company One", category: "Finance", start: 1981, end: 2004},
{name: "Company Two", category: "Retail", start: 1992, end: 2008},
{name: "Company Three", category: "Auto", start: 1999, end: 2007},
{name: "Company Four", category: "Retail", start: 1989, end: 2010},
{name: "Company Five", category: "Technology", start: 2009, end: 2014},
{name: "Company Six", category: "Finance", start: 1987, end: 2010},
{name: "Company Seven", category: "Auto", start: 1986, end: 1996},
{name: "Company Eight", category: "Technology", start: 2011, end: 2016},
{name: "Company Nine", category: "Retail", start: 1981, end: 1989}
@S-codes14
S-codes14 / sequentialSearch.c#
Created May 12, 2021 02:09
sequentialSearch in c#
// C# program for Indexed Sequential Search
using System;
class Program {
static void sequentialSearch(int []arr, int n, int k)
{
@S-codes14
S-codes14 / Tikbot.py
Created May 12, 2021 02:05
Tried to ceate a tik tok auto views bot, there are three diferent ways choose which one is great for you
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import pyfiglet
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
# from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
from time import sleep
@S-codes14
S-codes14 / getform.html
Created April 3, 2021 13:23
an example of getform email...
<!--
* Add your getform endpoint into "action" attribute
* Set a unique "name" field
* Start accepting submissions
-->
<form action="{getform-endpoint}" method="POST">
<input type="text" name="name">