DSAA补充之B树、B+树

漫画算法:什么是 B 树 漫画算法:什么是 B 树。 B树(英语:B-tree)是一种自平衡的树,能够保持数据有序。 這種資料結構能夠讓查找數據、顺序访问、插入數據及刪除的動作,都在對數時間內完成 立即下载

1. 回顾

以前记录的B树DSAA之B-tree(六),这个定义真是有点四不像啊。是B+树的感觉,又没有底层的link。所以今天有必要重新审视下B树和B+树的概念。本文内容摘自维基百科。

2. B树

定义

According to Knuth’s definition, a B-tree of order m is a tree which satisfies the following properties:

  • Every node has at most m children.
  • Every non-leaf node (except root) has at least ⌈m/2⌉ children.这个符号是向上取整的意思
  • The root has at least two children if it is not a leaf node.
  • A non-leaf node with k children contains k−1 keys.非子叶节点包含k-1个关键字,k为该节点的子代数目
  • All leaves appear in the same level

Each internal node’s keys act as separation values which divide its subtrees. For example, if an internal node has 3 child nodes (or subtrees) then it must have 2 keys: a1 and a2. All values in the leftmost subtree will be less than a1, all values in the middle subtree will be between a1 and a2, and all values in the rightmost subtree will be greater than a2.内部节点(非子叶节点)的关键字索引了它的所有子代,如[a1,a2]索引该节点的三个子代。

  • Internal nodes
  • Internal nodes are all nodes except for leaf nodes and the root node.
  • They are usually represented as an ordered set of elements and child pointers. Every internal node contains a maximum of U children and a minimum of L children. Thus, the number of elements is always 1 less than the number of child pointers (the number of elements is between L−1 and U−1).这个可以简单理解为内部节点的关键字的数目是该节点的子代数目-1,当然也可以直接理解:U为m,L为[m/2]向上取整
  • U must be either 2L or 2L−1; therefore each internal node is at least half full. The relationship between U and L implies that two half-full nodes can be joined to make a legal node, and one full node can be split into two legal nodes (if there’s room to push one element up into the parent). These properties make it possible to delete and insert new values into a B-tree and adjust the tree to preserve the B-tree properties.删除,插入操作会导致merge或者split,这个在以前的Btree记录帖子也有提到
  • The root node
  • The root node’s number of children has the same upper limit as internal nodes, but has no lower limit. root节点的子代不受[m/2]的限制
    • For example, when there are fewer than L−1 elements in the entire tree, the root will be the only node in the tree with no children at all.
  • Leaf nodes
    • Leaf nodes have the same restriction on the number of elements, but have no children, and no child pointers.

上面这些性质都是之前见过的,但是有一点很重要:

B-trees keep values in every node in the tree, and may use the same structure for all nodes. However, since leaf nodes never have children, the B-trees benefit from improved performance if they use a specialized structure.

例子

图片来自侵权自删
这里写图片描述
  这里与之前学习的B树定义有区别,DSAA中按照B+树的方式定义的,这里强调了每个节点都包含了key值,且每个节点的key值都是有序且唯一的。

最大深度

Let h be the height of the classic B-tree. Let n > 0 be the number of entries in the tree. d be the minimum number of children an internal (non-root) node can have. For an ordinary B-tree, d = ⌈ m / 2 ⌉ d=\left\lceil m/2\right\rceil d=⌈m/2⌉.
h ≤ ⌊ l o g d ( n + 1 2 ) ⌋ h \leq \left\lfloor log_{d}(\frac {n+1}{2})\right\rfloor h≤⌊logd​(2n+1​)⌋

可以直接当结论记忆,推导过程在《Introduction to Algorithms》中有详细论述。

3. B+树

因为B+树是B树的改进,所以可以通过两颗树的区别来学习B+树,以下来自Differences between B trees and B+ trees

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  • Advantages of B+ trees:
  • Because B+ trees don’t have data associated with interior nodes, more keys can fit on a page of memory. Therefore, it will require fewer cache misses in order to access data that is on a leaf node.理解这个有点需要先了解缓存机制
  • The leaf nodes of B+ trees are linked, so doing a full scan of all objects in a tree requires just one linear pass through all the leaf nodes.
    • A B tree, on the other hand, would require a traversal of every level in the tree. This full-tree traversal will likely involve more cache misses than the linear traversal of B+ leaves.
  • Advantage of B trees:
  • Because B trees contain data with each key, frequently accessed nodes can lie closer to the root, and therefore can be accessed more quickly.

总结下B+树就是从磁盘访问性能,和支持顺序查找两方面改进了B树。当然两者都支持随机查找。**另外对于是否当前节点的子代数目和key值数目保持一致,还是两者相差1的关系存在争议。无论是如何实现,只要保证前后一致就行。**在维基百科和stackoverflow的引用中都是按照B树的特点来介绍B+树的。

4. 两个笔试题

这里写图片描述
这里写图片描述

第一题A选择B树不支持顺序查找,第二题根据B树的root节点作为单节点树时,子代数为0,其他情况root的子代树至少为2,存储的key至少为1。假设所有的节点都存储了1个key值,此时按照满二叉树处理为:2^k-1=2047,k=11。如果按照维基百科上面的公式计算得到k=10,但是因为从k从零开始,所以k=10+1=11。然后这里出现歧义有的定义中B树叶子层不包含数据,上面维基百科和stackoverflow的引用遵循叶子层包含数据的定义。不同的定义下A或者B都可能正确。

【网络图】:附Origin详细画图教程 网络图,是一种由节点(或顶点)和连接这些节点的边(或链路)组成的图形结构。在网络图中,节点通常代表系统中的一个实体(如项目中的一项任务、通信网络中的一个设备、或运输网络中的一个站点),而边则代表这些实体之间的直接联系或流动(如任务的先后顺序、数据的传输路径、或乘客的旅行路线)。 有向图:如果边具有方向性,即从一个节点指向另一个节点,则称为有向图。这种图常用于表示具有明确先后顺序或方向性的系统,如项目管理中的任务依赖关系。 无向图:如果图中的边没有方向,则称为无向图。它适用于表示实体间相互关联但无明确方向性的 阅读详情

相关推荐

从封装到先进封装:一文讲透Chiplet、2.5D/3D堆叠与系统集成

封装是芯片产业链中连接硅片与电路板的桥梁,承担物理保护、电气连接、散热与机械支撑等核心任务。传统封装从DIP、QFP发展到BGA,通过提升引脚密度满足早期性能需求。随着摩尔定律放缓,单纯缩小晶体管尺寸难以为继,先进封装应运而生,其核心理念从“封装单颗芯片”转向“系统级高密度集成”。扇出型封装、2.5D硅中介层、3D堆叠、Chiplet和系统级封装等技术,通过微米级互连和垂直堆叠,大幅提升I/O密度与带宽,成为AI芯片、HBM存储、高性能计算等领域的关键支撑。本文梳理先进封装的技术演进、分层架构与工程难点,帮

weixin_29185167的博客 370

数据结构——查找の选择题整理

1、折半查找和二叉排序树的时间性能()A、相同B、有时不相同C、完全不同D、无法比较解析选折半查找的性能可以用二叉排序树来衡量,是O(logn),但是二叉排序树的时间性能还与存入的数据有关,如果是性能比较好的情况,则为O(logn),如果形成了单侧二叉树,时间性能就为O(n)。...

王王仙贝的博客 5808

智能音箱开发者必看:CEVA-BX vs Cadence HiFi音频DSP实战选型指南(附功耗对比表)

本文深入对比了CEVA-BX和Cadence HiFi两大音频DSP架构在智能音箱开发中的性能差异,涵盖语音唤醒、多麦克风阵列处理等核心场景。通过实测数据和功耗对比表,为开发者提供选型参考,帮助优化产品性能和能效表现。

weixin_29309213的博客 227

B树与B+树

B-树 B-tree树即B树,B即Balanced,平衡的意思。因为B树的原英文名称为B-tree,而国内很多人喜欢把B-tree译作B-树,其实,这是个非常不好的直译,很容易让人产生误解。如人们可能会以为B-树是一种树,而B树又是另一种树。而事实上是,B-tree就是指的B树,特此说明。 B-树是一种多路搜索树,形如: 特点 1、任何一个关键字出现且只出现在一个结点中; 2、非叶子节点除

超帅哥哥的人生巅峰 1767

手把手教你用certificate-manager修复Vcenter证书过期问题(附密码重置技巧)

本文详细解析了Vcenter证书过期引发的503服务不可用、密码错误等典型故障现象,并提供了使用certificate-manager工具进行系统性修复的完整步骤。文章重点阐述了证书体系原理、精准诊断方法,并分享了在SSO验证失败时通过vdcadmintool重置密码的关键技巧,帮助管理员快速恢复平台并建立预防性运维策略。

swift5iosmith的博客 461

手把手用ROS实现Ego-Planner动态避障:无人机撞树问题终结方案

本文详细介绍了如何在ROS和Gazebo仿真环境中,通过配置和调优Ego-Planner算法,实现无人机的动态避障功能。文章深入解析了其基于局部梯度优化的核心思想,提供了从环境搭建、参数详解到代码集成的完整实践指南,并分享了实战排错经验,旨在彻底解决无人机在复杂动态场景中的碰撞问题。

weixin_29031161的博客 1633

B树和B+树的查找方式及原因

目录 先把结论放上 大致定义 B树支持随机查找 B+树支持随机查找和顺序查找 先把结论放上 B树仅支持随机查找 B+树支持随机查找和顺序查找 大致定义 至于B树和B+树的定义我就不展开了,随便找了两张图大家能有个大致的印象就行了 学习的时候对于这两个支持的查找有点疑惑,但是也没找到专门解释的,于是准备写一下自己的理解 B树支持随机查找 起初我想的是这明明是一个树形结构,随机查找又是通过下标来查找的,为啥能支持随机查找呢?后来大概有些明白了 单看树的每一个节点,一个节...

ThePythonFucker的博客 1万+

变邻域搜索(VNS)原理梳理和应用细节-附求解VRPTW问题C++代码

文章目录1、简介-introduction2、VNS的基本机制2.1 变邻域下降方法-Variable Neighborhood Descent2.2基本变邻域搜索方法-Basic Variable Neighborhood Search2.3 终止准则3、VNS的拓展和混杂算法3.1 VNS的拓展3.2 变邻域分解搜索-Variable Neighborhood Decomposition Search3.3 偏变邻域搜索-Skewed VNS3.4 并行变邻域搜索-Parallel VNS4、VNS和其

dragon Fly的博客 6827

数据结构学习笔记——查找算法中的树形查找(B树、B+树)

B树和B+树属于树形查找算法中的一种,主要用于数据库系统、文件系统和磁盘存取等方面,都是用于存储和索引大量的数据,以提高检索效率。例如,在磁盘存储中,通过将数据分散到多个磁盘块中,并使用树形结构来组织这些磁盘块,从而提高了查找速度和查找效率。若设B树中所有结点的孩子结点个数的最大值为m,则该B树是一棵m阶B树,另外B+树则是B树的变形。B+树可以由分块查找推广,所以也称为多级分块查找,即m阶B+树,它是B树的变形,与B树相同,B树和B+树都是平衡的多叉树,都用在文件索引结构和数据库索引中,但B+树更加适用。

小宇y的博客 3201

从NVLINK到EthLink:GPU互联技术演进全解析(含最新行业趋势)

本文深入解析了从NVLINK到EthLink的GPU互联技术演进,重点剖析了Scale-up与Scale-out两种核心范式。文章详细对比了NVLINK、UALINK及革命性的EthLink技术,后者创新性地将以太网改造为支持Load/Store与RDMA双语义的高性能互联网络,旨在打破封闭生态,实现高性能与开放性的统一。最后,文章提供了技术选型指南并展望了未来以以太网为主导、语义融合的行业趋势。

weixin_29204749的博客 179

容器化部署指南——Docker/K8s环境下的OpenClaw实践(附Dockerfile)

通过本文的详细指导,你已经掌握了OpenClaw在Docker和Kubernetes环境中的容器化部署方法。从基础镜像构建到高级部署策略,从开发环境到生产环境,你现在已经具备了完整的容器化部署能力。 容器化技术为OpenClaw提供了灵活、可扩展、可移植的部署方案,能够满足不同规模和需求的应用场景。通过合理使用Docker和Kubernetes,你可以实现高效的部署管理和运维自动化。 在实际应用中,建议根据具体的业务需求选择合适的部署策略,并结合监控、日志、安全等最佳实践,确保系统的稳定性和可靠性。同时

博客 499

二叉搜索树,avl树,红黑树,B树,B+树介绍

数据结构

junaozun的博客 787

FPGA实现AXI-Stream通信

本文介绍了在FPGA中实现AXI-Stream接口的工业级方案,重点解析了核心协议信号(TVALID/TREADY/TDATA/TLAST)与可选扩展信号,并提供了Verilog最小化实现示例。文章详细阐述了握手协议规则、时序约束方法,以及吞吐量优化技巧(如寄存器切片和双缓冲策略),同时给出了跨时钟域处理的异步FIFO解决方案。此外,还包含验证调试方法(Testbench结构和ILA触发设置)和典型应用场景(视频处理/网络传输),最后提供了资源消耗参考数据。该实现方案严格遵循Xilinx/Intel官方规范

whm128的博客 1468

DSAA Homework 2

DSAA Homework 2

Sidney_Sun的博客 351

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

DSAA 第一章 引论

练习(p12) 1.1 /* * date: 2016-01-14 * question: 编写一个程序解决选择问题,令 k = N/2。 */ #include <stdlib.h> // use rand () and srand () 动态生成数组 #include <stdio.h> #include <s...

diaochaigang4181的博客 363

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

DSAA B第三次assignment q2 paths(南科大)

用dfs求解树中从根节点到末端子节点的总counts值满足某个条件的个数

qq_58127949的博客 242

DSAA b Elementary sort Feedback (SUStech)

常用的sort方法,merge sort, quick sort and priority queue

qq_58127949的博客 209

DSAA B第三次assignment q1 parents(南科大)

用dfs查找简单树组父节点集合

qq_58127949的博客 288

DSAA之图论Dijkstra(贪婪算法)(五)

1. 前言   有网友把Dijkstra归为BFS算法,笔者觉得是不准确的,两者的差别在于每个阶段是否是最优选择,也就是是否达到局部最优,当然不保证全局最优。 2. 定义 We keep all of the same information as before. Thus, each vertex is marked as either known or unknown. A ...

LoveStackover的博客 438

keras系列二(补充)theano的tensor库

今天看keras的模块,都是调用的theano的方法,感觉有必要补一下tensor相关知识,下面将学习一下tensor的一般用法和自己的理解。

zjm750617105的专栏 3269

撒斯泰克大学2020秋季dsaa题目

先上原题 Tower of Hanoi is one of the most famous puzzles in the world. There are three different rods labeled A, B and C. The puzzle starts with the disks in ascending order of size on the A rod (The smallest at the top). You have the following rules: Only o

u013967394的博客 265

DSAA b BST &(balance)BST code analysis II(南科大)

平衡搜索树代码方法实例

qq_58127949的博客 195

DSAA b BST &(balance)BST code analysis(南科大)

DSAA BST&(balance)BST BST

qq_58127949的博客 151

DSAA之中缀转后缀表达式(三)

1. 简单回顾   笔者认为该算法,只需要记住流程,而记住流程的关键就是多做几个笔试选择题,比如 牛客网:   可以完全按照中缀表达式转换成后缀表达式的算法来: 步骤 栈 后缀表达式 遇到X输出 空 X 遇到=入栈 = X 遇到A输出 = XA 遇到A输出 = XA 遇到+,比=优先级高,入栈 ...

LoveStackover的博客 306

Weiss-(DSAA - in C,2.19) 大小为N的数组A,其主要元素出现次数超过N/2

/* 大小为N的数组A,其主要元素是一个出现次数超过N/2的元素(这样的元素只有一个) 算法概要: 第一步: 找出主要元素的一个候选元(这是难点)。这个候选元是唯一有可能是主要元素的元素。 第二步: 确定是否这个候选元是主要元素。 为了找出候选元,构造第二个数组B。 比较A1和A2,如果它们相等则取其中之一加到数组B中;否则什么都不

ManHand的博客 1300

hp203b例程_HP-Socket 官方例程解析

HP-Socket 官方库项目的地址ldcsaa/HP-Socket: High Performance TCP/UDP/HTTP Communication Componenthttps://github.com/ldcsaa/HP-Socket环境:ubuntu本文基于其readme中的C++程序来做分析git中提供的《HP-Socket网络通信框架开发指南》还是需要反复好好看的工作流程创建监...

weixin_42523543的博客 930

java b1 b1 be a9,155a427b6c1d4da9b1d721577b843a83.md

id: 155a427b6c1d4da9b1d721577b843a83parent_id: 605b8b554d3a4ad9bf292e8089296314item_type:item_id:item_updated_time:title_diff:body_diff:metadata_diff:encryption_cipher_text: JED010000220195dbe43a48d54...

weixin_30444697的博客 385
上一篇: 《DP学习系列》从零开始学习动态规划,泛化物品(八)
下一篇: DSAA之图论Euler Circuits问题(九)
LoveStackover
博客等级 码龄9年 14粉丝 57原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值