• 动态规划全优化理解

    一.动态规划总思路 二. 动态问题分类 0 1 背包问题 完全背包问题 1. 01 背包问题 每件物品只能选一次,选出价值最大的物品 #include using namespace std; const int N = 1010; int n, m; int v[N], w[N]; int fN; int main () { cin >> n >> m; for (int i = 1; i > v[i] >> w[i]; for (int i ...

    13 天前(已编辑)
    40
    阅读全文
  • 模拟call

    1.模拟call Function.prototype.mycall = function(context = window, ...args){ if(this == Function.prototype){ return undefined; } context = context || window; const fn = Symbol(); context[fn] = this; const result = contextfn; delete context[fn] ...

    2025 年 3 月 26 日 星期三(已编辑)
    1
    阅读全文
  • 手动实现一个Ajax

    1.手动实现一个Ajax function myAjax(config){ let { url, method = 'get', data = {}, async = true, success, fail } = config let xml = new XMLHttpRequest() xml.onreadystatechange = function(){ if(xml.readyState == 4){ ...

    2025 年 3 月 26 日 星期三(已编辑)
    9
    阅读全文
  • 模拟apply

    2.模拟apply Function.prototype.myapply = function(context = window, args){ if(this == Function.prototype){ return undefined; } context = context || window; const fn = Symbol(); context[fn] = this; if (Array.isArray(args)) { result = contextfn...

    2025 年 3 月 26 日 星期三(已编辑)
    2
    阅读全文
  • Object.assign

    Object.assign function assign(target: object, ...sources: any[]): object { if (!isObject(target)) { throw new TypeError('The target must be an Object not a function') } sources.forEach(source => { let descriptors = Object.keys(source).reduce((descriptor, key) => { ...

    2025 年 3 月 26 日 星期三(已编辑)
    1
    阅读全文
  • 防抖和节流函数实现

    1.手写防抖 function debounce(handleEvent, time, flag){ let timeout = null; return function(...agrs){ clearTimeout(timeout) if(flag && !timeout){ handleEvent.apply(this, args) } timeout = setTimeout(()=>{ handleEvent.apply(this, arg...

    2025 年 3 月 26 日 星期三(已编辑)
    4
    阅读全文
  • deepCopy

    ## 1.手写深克隆 ```js function copy(data){ let obj = data instanceof Array ? [] : {} for (const [k,v] of Object.entries(data)) { obj[k] = typeof v == "object" ? copy(v) : v; } return obj } ```

    2025 年 3 月 26 日 星期三(已编辑)
    1
    阅读全文
  • JS继承实现

    7.手动实现ES5的继承 function People() { this.type = 'prople' } People.prototype.eat = function () { console.log('吃东西啦'); } function Man(name) { this.name = name; this.color = 'black'; } No.1原型继承 Man.prototype = new People(); let a = new Man() console.log(a.__prot...

    2025 年 3 月 26 日 星期三(已编辑)
    阅读全文
  • 手动实现一个instanceof

    ## 1.手动实现一个instanceof ```js function myinstanceof(target, origin){ let proto = target.__proto__ if(proto){ if(proto === origin.prototype){ return true }else{ return myinstanceof(proto, origin) } }else{ return false } } ```

    2025 年 3 月 26 日 星期三(已编辑)
    5
    阅读全文
  • 图片懒加载

    12.图片懒加载 let imgs = document.getElementsByTagName("img"); let n = 0 lazyload() //节流函数 function throttle(handleEvent,time){ let timer return function(...args){ if(timer){ timer = setTimeout(() => { timer = null handleEvent.apply(...

    2025 年 3 月 26 日 星期三(已编辑)
    6
    阅读全文
关于关于本站关于我
更多时间线友链
联系写留言发邮件GitHub
© 2020-2025 jiuran. | RSS | 站点地图 | | Stay hungry. Stay foolish.
Powered by Mix Space&. | 萌 ICP 备 20236136 号 |