Skip to content

Instantly share code, notes, and snippets.

View a-alhusaini's full-sized avatar

Abdullah Alhusaini a-alhusaini

View GitHub Profile
@a-alhusaini
a-alhusaini / insort.js
Created August 1, 2023 20:06
Binary Searching Sorted Array
let arr = []
for (let i = 0; i < 12900000; i++) {
if (i == 60000000) continue
arr.push(i)
}
function insort(arr, item) {
let low = 0;
let high = arr.length - 1;
@a-alhusaini
a-alhusaini / geneticknapsack.js
Created September 20, 2022 22:47
Solving the knapsack problem with genetic algorithms.
let items = [
{
name: "laptop",
weight: 1.5,
price: 1000,
},
{
name: "speakers",
weight: 0.5,
price: 200,