
Combinatorial problem: How many trees can be created with n labeled vertices?
more >>
无聊又咸鱼

Combinatorial problem: How many trees can be created with n labeled vertices?
more >>
In the previous blog post Time complexity and shortcoming of Binary Search, we calculated that approximately the average search length is
要实现所谓的Fibonacci查找,首先来实现Fibonacci数列类。
Fibonacci数列最早由数学家Leonardoda Fibonacci提出,它指的是一种满足如下递推关系的数列:
上一篇博客《从零开始的数据结构之向量》具体实现了基于有序向量的二分查找,即如下代码段:
1
2
3
4
5
6
7
8
9
10
11
12
13 template <typename T>
Rank vector<T>::search(T const & e,Rank lo,Rank hi) //二分查找
{
int mi;
while(lo<hi) //将递归改为迭代
{
mi=(lo+hi)>>1;
if(e<_elem[mi]) hi=mi;
else if(e>_elem[mi]) lo=mi+1;
else return mi;
}
return -1; //查找失败
}
在以上查找中,所花费的时间主要分为两类:元素的大小比较、秩的算术运算及其赋值。
more >>
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true