Skip to content

Instantly share code, notes, and snippets.

View ismaelsadeeq's full-sized avatar
🍭
learning and building

Abubakar Sadiq Ismail ismaelsadeeq

🍭
learning and building
View GitHub Profile
@ismaelsadeeq
ismaelsadeeq / fast_exp.cpp
Last active June 28, 2025 13:01
crypto_camp_exercise_1
#include <iostream>
#include <optional>
#include <cassert>
/*
* Fast exponentiation using iterative binary exponentiation.
* This efficiently computes (base ^ exponent) % modulo (if provided) in O(log exponent) time.
* When modulo is provided, intermediate values stay small and avoid overflow.
* Without modulo, results can quickly exceed the storage limits of the int type.
INT_MAX is typically 2,147,483,647 for 32-bit int.
@ismaelsadeeq
ismaelsadeeq / fee_design.md
Last active April 13, 2025 14:10
Bitcoin Core Fee Estimator Design

Bitcoin Core ASAP (1,2) Fee Estimation Design

1. Introduction

This document introduces a modular and extensible fee estimation system for Bitcoin Core. The design is centered around a fee rate forecasting manager that integrates multiple fee rate forecasting strategies and performs mempool health checks to determine the most appropriate strategy for providing fee rate forecast. This approach facilitates the additions of new strategies while ensuring smooth integration with existing systems.

2. Design Overview

The system is organized into two primary components:

Another attempt at #23074

1. Update TxStatsInfo to have the following additional fields:

  • ancestors: std::set of uint256
  • descendants: std::set of uint256
  • nSize: CAmount
  • txFee: uint64_t
@ismaelsadeeq
ismaelsadeeq / interestingQuery.py
Created December 27, 2022 10:44
Interesting Queries
#User function Template for python3
import math
class Solution:
def solveQueries(self, nums, Queries, k):
originalLocation = Solution.saveQueryLocation(Queries)
Queries = Solution.sortQ(Queries,len(nums),nums)
@ismaelsadeeq
ismaelsadeeq / moving_median.js
Created November 14, 2022 10:42
Moving median
function findMovingMovingMedian(arr){
//check edge cases
let median = ''
if(arr.length==0){
return median
}
if(arr.length ==1){
return arr[0]
}
function generateId(startIn?: number){
startIn? null: startIn = 1
if(startIn>1000000){
return false;
}
let randomId:number = 100000+Math.floor(Math.random() * 9000000);
if(startIn>0){
@ismaelsadeeq
ismaelsadeeq / list.js
Created January 31, 2022 19:49
Linked List implementation with Javascript ES9
class Node {
constructor(element) {
this.element = element;
this.next = null;
}
}
class LinkedList {
constructor() {
this.head = null,
this.size = 0