ICode9

精准搜索请尝试: 精确搜索
  • C++ 代码模板:整数二分2021-12-11 13:32:59

    // 区间 [l, r] 被划分成 [l, mid] 和 [mid + 1, r] 时使用 int bisearch_1(int l int r) { while ( l < r ) { int mid = l + r >> 1; if ( check(mid) ) r = mid; // check()判断mid是否满足性质 else l = mid + 1; } return l; }

  • 折半查找2021-10-14 16:04:46

    #include <iostream> using namespace std; int bisearch(int* a,int low,int high,int h)//递归调用 { int f = (low + high) / 2; if (a[f] == h) return f; else if (h < a[f]) bisearch(a, low, f - 1, h); else if (h > a[f])bisearch(a, f + 1

  • 算法第二章上机实验报告2021-09-30 23:02:07

    一、实践题目  maximum number in a unimodal array You are a given a unimodal array of n distinct elements, meaning that its entries are in increasing order up until its maximum element, after which its elements are in decreasing order. Give an algor

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有