日撸java_day66-68

news2025/3/10 18:59:16

文章目录

  • 主动学习ALEC
    • 代码
    • 运行结果

主动学习ALEC

代码

package machineLearning.activelearning;

import weka.core.Instances;

import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;

/**
 * ClassName: Alec
 * Package: machineLearning.activelearning
 * Description: Active learning through density clustering.
 *
 * @Author: luv_x_c
 * @Create: 2023/8/21 14:26
 */
public class Alec {
    /**
     * The whole dataset.
     */
    Instances dataset;

    /**
     * The maximal number of queries that can be provided.
     */
    int maxNumQuery;


    /**
     * The actual number of queries.
     */
    int numQuery;

    /**
     * The radius, also dc in the paper. It is employed for density computation.
     */
    double radius;

    /**
     * The densities of instances.
     */
    double[] densities;

    /**
     * DistanceToMaster
     */
    double[] distanceToMaster;

    /**
     * Sorted indices, where the first element indicates the instance with the biggest density,
     */
    int[] descendantDensities;

    /**
     * Priority.
     */
    double[] priority;

    /**
     * The maximal distance between any pair of points.
     */
    double maximalDistance;

    /**
     * Who is my master?
     */
    int[] masters;

    /**
     * Predicted labels.
     */
    int[] predictedLabels;

    /**
     * Instance status. 0 for unprocessed, 1 for queried, 2 for classified.
     */
    int[] instanceStatusArray;

    /**
     * The descendant indices to show the representatives of instances in a descendant order.
     */
    int[] descendantRepresentatives;

    /**
     * Indicate the cluster of each instance. It is only used in clusterInTwo(int[]).
     */
    int[] clusterIndices;

    /**
     * Blocks with size more than this threshold should not be split further.
     */
    int smallBlockThreshold = 3;

    /**
     * The constructor.
     *
     * @param paraFileName The data filename.
     */
    public Alec(String paraFileName) {
        try {
            FileReader fileReader = new FileReader(paraFileName);
            dataset = new Instances(fileReader);
            dataset.setClassIndex(dataset.numAttributes() - 1);
            fileReader.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }//Of try

        computeMaximalDistance();
        clusterIndices = new int[dataset.numInstances()];
    }//OF the constructor

    /**
     * Merge sort in descendant order to obtain an index array. The original array  is unchanged.
     * The method should be tested further.
     *
     * @param paraArray The original array.
     * @return The sorted indices.
     */
    public static int[] mergeSortToIndices(double[] paraArray) {
        int tempLength = paraArray.length;
        int[][] resultMatrix = new int[2][tempLength];

        // Initialize
        int tempIndex = 0;
        for (int i = 0; i < tempLength; i++) {
            resultMatrix[tempIndex][i] = i;
        }//Of for i

        // Merge
        int tempCurrentLength = 1;
        // The indices for current merged groups.
        int tempFirstStart, tempSecondStart, tempSecondEnd;

        while (tempCurrentLength < tempLength) {
            // Divide into a number of groups.
            // Here the boundary is adaptive to array length not equal to 2^k
            for (int i = 0; i < Math.ceil((tempLength + 0.0) / tempCurrentLength / 2); i++) {
                // Boundaries of the group
                tempFirstStart = i * tempCurrentLength * 2;

                tempSecondStart = tempFirstStart + tempCurrentLength;

                tempSecondEnd = tempSecondStart + tempCurrentLength - 1;
                if (tempSecondEnd >= tempLength) {
                    tempSecondEnd = tempLength - 1;
                }//Of if

                // Merge this group
                int tempFirstIndex = tempFirstStart;
                int tempSecondIndex = tempSecondStart;
                int tempCurrentIndex = tempFirstStart;

                if (tempSecondStart >= tempLength) {
                    for (int j = tempFirstIndex; j < tempLength; j++) {
                        resultMatrix[(tempIndex + 1) % 2][tempCurrentIndex] =
                                resultMatrix[tempIndex % 2][j];
                        tempFirstIndex++;
                        tempCurrentIndex++;
                    }//OF for j
                    break;
                }//OF if

                while ((tempFirstIndex <= tempSecondStart - 1) && (tempSecondIndex <= tempSecondEnd)) {
                    if (paraArray[resultMatrix[tempIndex % 2][tempFirstIndex]] >= paraArray[resultMatrix[tempIndex % 2][tempSecondIndex]]) {
                        resultMatrix[(tempIndex + 1) % 2][tempCurrentIndex] =
                                resultMatrix[tempIndex % 2][tempFirstIndex];
                        tempFirstIndex++;
                    } else {
                        resultMatrix[(tempIndex + 1) % 2][tempCurrentIndex] =
                                resultMatrix[tempIndex % 2][tempSecondIndex];
                        tempSecondIndex++;
                    }//Of if
                    tempCurrentIndex++;
                }//Of while

                // Remaining part
                for (int j = tempFirstIndex; j < tempSecondStart; j++) {
                    resultMatrix[(tempIndex + 1) % 2][tempCurrentIndex] =
                            resultMatrix[tempIndex % 2][j];
                    tempCurrentIndex++;
                }//Of for j
                for (int j = tempSecondIndex; j <= tempSecondEnd; j++) {
                    resultMatrix[(tempIndex + 1) % 2][tempCurrentIndex] =
                            resultMatrix[tempIndex % 2][j];
                    tempCurrentIndex++;
                }//Of for j
            }//Of for i

            tempCurrentLength *= 2;
            tempIndex++;
        }//Of while

        return resultMatrix[tempIndex % 2];
    }//Of mergeSortToIndices

    /**
     * The Euclidean distance between two instances.
     *
     * @param paraI The index of the first instance.
     * @param paraJ The index of the second instance.
     * @return The distance.
     */
    public double distance(int paraI, int paraJ) {
        double resultDistance = 0;
        double tempDifference;
        for (int i = 0; i < dataset.numAttributes() - 1; i++) {
            tempDifference = dataset.instance(paraI).value(i) - dataset.instance(paraJ).value(i);
            resultDistance += tempDifference * tempDifference;
        }//Of for i
        resultDistance = Math.sqrt(resultDistance);

        return resultDistance;
    }//Of distance

    /**
     * Compute the maximal distance. The result is stored in a member variable.
     */
    public void computeMaximalDistance() {
        maximalDistance = 0;
        double tempDistance;
        for (int i = 0; i < dataset.numInstances(); i++) {
            for (int j = 0; j < dataset.numInstances(); j++) {
                tempDistance = distance(i, j);
                if (maximalDistance < tempDistance) {
                    maximalDistance = tempDistance;
                }//Of if
            }//Of for j
        }//Of for i

        System.out.println("maximalDistance = " + maximalDistance);
    }//Of computeMaximalDistance

    /**
     * Compute the densities using Gaussian kernel.
     */
    public void computeDensitiesGaussian() {
        System.out.println("Radius = " + radius);
        densities = new double[dataset.numInstances()];
        double tempDistance;

        for (int i = 0; i < dataset.numInstances(); i++) {
            for (int j = 0; j < dataset.numInstances(); j++) {
                tempDistance = distance(i, j);
                densities[i] += Math.exp(-tempDistance * tempDistance / radius / radius);
            }//Of for j
        }//OF for i

        System.out.println("The densities are: " + Arrays.toString(densities) + "\r\n");
    }//Of computeDensitiesGaussian

    /**
     * \
     * Compute distanceToMaster, the distance to its master.
     */
    public void computeDistanceToMaster() {
        distanceToMaster = new double[dataset.numInstances()];
        masters = new int[dataset.numInstances()];
        descendantDensities = new int[dataset.numInstances()];
        instanceStatusArray = new int[dataset.numInstances()];

        descendantDensities = mergeSortToIndices(densities);
        distanceToMaster[descendantDensities[0]] = maximalDistance;

        double tempDistance;
        for (int i = 1; i < dataset.numInstances(); i++) {
            // Initialize
            distanceToMaster[descendantDensities[i]] = maximalDistance;
            for (int j = 0; j <= i - 1; j++) {
                tempDistance = distance(descendantDensities[i], descendantDensities[j]);
                if (distanceToMaster[descendantDensities[i]] > tempDistance) {
                    distanceToMaster[descendantDensities[i]] = tempDistance;
                    masters[descendantDensities[i]] = descendantDensities[j];
                }//Of if
            }//Of  for j
        }//Of for i
        System.out.println("First compute, masters = " + Arrays.toString(masters));
        System.out.println("descendantDensities = " + Arrays.toString(descendantDensities));
    }//Of computeDistanceToMaster

    /**
     * Compute priority. Element with higher priority is more likely to be
     * selected as a cluster center. Now it is rho * distanceToMaster. It can
     * also be rho^alpha * distanceToMaster.
     */
    public void computePriority() {
        priority = new double[dataset.numInstances()];
        for (int i = 0; i < dataset.numInstances(); i++) {
            priority[i] = densities[i] * distanceToMaster[i];
        }//Of for i
    }//Of computePriority

    /**
     * The block of a node should be same as its master. This recursive method is efficient.
     *
     * @param paraIndex The index of the given node.
     * @return The cluster index of the current node.
     */
    public int coincideWithMaster(int paraIndex) {
        if (clusterIndices[paraIndex] == -1) {
            int tempMaster = masters[paraIndex];
            clusterIndices[paraIndex] = coincideWithMaster(tempMaster);
        }//Of if

        return clusterIndices[paraIndex];
    }//Of coincideWithMaster

    /**
     * Cluster a block in two. According to the master tree.
     *
     * @param paraBlock The given block.
     * @return The new blocks where the two most represent instances serve as
     * the root.
     */
    public int[][] clusterInTwo(int[] paraBlock) {
        //Reinitialize. In fact, only instances in the given block is considered.
        Arrays.fill(clusterIndices, -1);

        // Initialize the cluster number of the two roots.
        for (int i = 0; i < 2; i++) {
            clusterIndices[paraBlock[i]] = i;
        }//Of for i

        for (int i = 0; i < paraBlock.length; i++) {
            if (clusterIndices[paraBlock[i]] != -1) {
                // Already have a cluster number
                continue;
            }//Of if

            clusterIndices[paraBlock[i]] = coincideWithMaster(masters[paraBlock[i]]);
        }//Of for i

        // The sub blocks.
        int[][] resultBlocks = new int[2][];
        int tempFirstBlockCount = 0;
        for (int i = 0; i < clusterIndices.length; i++) {
            if (clusterIndices[i] == 0) {
                tempFirstBlockCount++;
            }//Of if
        }//Of for i
        resultBlocks[0] = new int[tempFirstBlockCount];
        resultBlocks[1] = new int[paraBlock.length - tempFirstBlockCount];

        int tempFirstIndex = 0;
        int tempSecondIndex = 0;
        for (int i = 0; i < paraBlock.length; i++) {
            if (clusterIndices[paraBlock[i]] == 0) {
                resultBlocks[0][tempFirstIndex] = paraBlock[i];
                tempFirstIndex++;
            } else {
                resultBlocks[1][tempSecondIndex] = paraBlock[i];
                tempSecondIndex++;
            } // Of if
        } // Of for i

        System.out.println("Split (" + paraBlock.length + ") instances "
                + Arrays.toString(paraBlock) + "\r\nto (" + resultBlocks[0].length + ") instances "
                + Arrays.toString(resultBlocks[0]) + "\r\nand (" + resultBlocks[1].length
                + ") instances " + Arrays.toString(resultBlocks[1]));
        return resultBlocks;
    }//Of clusterInTwo

    /**
     * Classify instances in the block by simple voting.
     *
     * @param paraBlock The given block.
     */
    public void vote(int[] paraBlock) {
        int[] tempClassCounts = new int[dataset.numClasses()];
        for (int i = 0; i < paraBlock.length; i++) {
            if (instanceStatusArray[paraBlock[i]] == 1) {
                tempClassCounts[(int) dataset.instance(paraBlock[i]).classValue()]++;
            }//Of if
        }//Of for i

        int tempMaxClass = -1;
        int tempMaxCount = -1;
        for (int i = 0; i < tempClassCounts.length; i++) {
            if (tempMaxCount < tempClassCounts[i]) {
                tempMaxClass = i;
                tempMaxCount = tempClassCounts[i];
            }//Of if
        }//Of for i

        // Classify unprocessed instances.
        for (int i = 0; i < paraBlock.length; i++) {
            if (instanceStatusArray[paraBlock[i]] == 0) {
                predictedLabels[paraBlock[i]] = tempMaxClass;
                instanceStatusArray[paraBlock[i]] = 2;
            }//Of if
        }//Of for i
    }// Of vote

    /**
     * Cluster based active learning.
     *
     * @param paraRatio               The ratio of the maximal distance as the dc.
     * @param paraMaxNumQuery         The maximal number of queries for the whole dataset.
     * @param paraSmallBlockThreshold The small block threshold.
     */
    public void clusterBasedActiveLearning(double paraRatio, int paraMaxNumQuery,
                                           int paraSmallBlockThreshold) {
        radius = maximalDistance * paraRatio;
        smallBlockThreshold = paraSmallBlockThreshold;

        maxNumQuery = paraMaxNumQuery;
        predictedLabels = new int[dataset.numInstances()];

        for (int i = 0; i < dataset.numInstances(); i++) {
            predictedLabels[i] = -1;
        }//Of for i

        computeDensitiesGaussian();
        computeDistanceToMaster();
        computePriority();
        descendantRepresentatives = mergeSortToIndices(priority);
        System.out.println("descendantRepresentatives = " + Arrays.toString(descendantRepresentatives));

        numQuery = 0;
        clusterBasedActiveLearning(descendantRepresentatives);
    }//Of clusterBasedActiveLearning

    /**
     * Cluster based active learning.
     *
     * @param paraBlock The given block. This block must be sorted according to the priority in
     *                  descendant order.
     */
    public void clusterBasedActiveLearning(int[] paraBlock) {
        System.out.println("clusterBasedActiveLearning for block " + Arrays.toString(paraBlock));

        // Step1. How many labels are queried for this block.
        int tempExceptedQueries = (int) Math.sqrt(paraBlock.length);
        int tempNumQuery = 0;
        for (int i = 0; i < paraBlock.length; i++) {
            if (instanceStatusArray[paraBlock[i]] == 1) {
                tempNumQuery++;
            }//Of if
        }//Of for i

        // Step2. Vote for small blocks.
        if ((tempNumQuery >= tempExceptedQueries) && (paraBlock.length <= smallBlockThreshold)) {
            System.out.println("" + tempNumQuery + " instances are queried, vote for block: \r\n" + Arrays.toString(paraBlock));
            vote(paraBlock);

            return;
        }//Of if

        // Step3. Query enough labels.
        for (int i = 0; i < tempExceptedQueries; i++) {
            if (numQuery >= maxNumQuery) {
                System.out.println("No more queries are provided, numQuery =" + numQuery + ".");
                vote(paraBlock);
                return;
            }//Of if

            if (instanceStatusArray[paraBlock[i]] == 0) {
                instanceStatusArray[paraBlock[i]] = 1;
                predictedLabels[paraBlock[i]] = (int) dataset.instance(paraBlock[i]).classValue();
                numQuery++;
            }//Of if
        }//Of for i

        // Step4. Pure?
        int tempFirstLabel = predictedLabels[paraBlock[0]];
        boolean tempPure = true;
        for (int i = 1; i < tempExceptedQueries; i++) {
            if (predictedLabels[paraBlock[i]] != tempFirstLabel) {
                tempPure = false;
                break;
            }//Of if
        }// Of for i

        if (tempPure) {
            System.out.println("Classify for pure block: " + Arrays.toString(paraBlock));
            for (int i = tempExceptedQueries; i < paraBlock.length; i++) {
                if (instanceStatusArray[paraBlock[i]] == 0) {
                    predictedLabels[paraBlock[i]] = tempFirstLabel;
                    instanceStatusArray[paraBlock[i]] = 2;
                }//Of if
            }//Of for i
            return;
        }//OF if

        // Step5. Split in two and process them independently
        int[][] tempBlocks = clusterInTwo(paraBlock);
        for (int i = 0; i < 2; i++) {
            // Attention : recursive invoking here.
            clusterBasedActiveLearning(tempBlocks[i]);
        }// Of for i
    }// Of clusterBasedActiveLearning

    @Override
    public String toString() {
        int[] tempStatusCounts = new int[3];
        double tempCorrect = 0;
        for (int i = 0; i < dataset.numInstances(); i++) {
            tempStatusCounts[instanceStatusArray[i]]++;
            if (predictedLabels[i] == (int) dataset.instance(i).classValue()) {
                tempCorrect++;
            }//Of if
        }//Of for i

        String resultString =
                "(unhandled, queried, classified) =" + Arrays.toString(tempStatusCounts);
        resultString += "\r\nCorrect = " + tempCorrect + ", accuracy = " + (tempCorrect / dataset.numInstances());

        return resultString;
    }// OF toString

    /**
     * The entrance of the program.
     *
     * @param args Not used.
     */
    public static void main(String[] args) {
        long tempStart = System.currentTimeMillis();

        System.out.println("Start ALEC.");
        String arffFilename = "E:\\java_code\\data\\sampledata\\iris.arff";

        Alec tempAlec = new Alec(arffFilename);

        tempAlec.clusterBasedActiveLearning(0.15, 30, 3);

        System.out.println(tempAlec);

        long tempEnd = System.currentTimeMillis();
        System.out.println("Runtime: " + (tempEnd - tempStart) + "ms.");
    }// Of main
}// Of class Alec

运行结果

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/999105.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Linux中的虚拟文件系统(virtual file system)

要回答为何Linux系统能够支持多种不同类型的文件系统&#xff1f;是怎么做到的&#xff1f;这就得研究一下Linux中的虚拟文件系统&#xff08;简写为VFS&#xff09;&#xff0c;才能给出答案了。 虚拟文件系统&#xff08;VFS&#xff09; 是一个处于内核中的软件层&#xff0…

智能交叉领域的几个“为什么”?

智能是一个交叉性学科&#xff0c;涵盖了计算机科学、数学、物理、逻辑学、心理学、社会学等多个领域。它的研究和应用领域广泛&#xff0c;包括人机交互、人机融合智能、机器学习、自然语言处理、计算机视觉、智能控制等。 尽管智能在近年来发展迅速&#xff0c;但仍然有人可能…

数据库_之常用API的使用

数据库_之电商API MySQL C API 使用&#xff08;基本函数&#xff09; Mysql C API函数详解 MySQL的常用API 一个常用的程序调用MySQL数据库的时候通常都会调用以下API,下面来逐个分析. mysql_init() //函数原型 MYSQL *STDCALL mysql_init(MYSQL *mysql);这个API主要是用来分…

IP的基础知识、子网掩码、网关、CIDR

IP IP指网际互连协议&#xff0c;Internet Protocol的缩写&#xff0c;是TCP/IP体系中的网络层协议。 设计IP的目的是提高网络的可扩展性&#xff1a;一是解决互联网问题&#xff0c;实现网络的互联互通&#xff1b;二是解除顶层网络应用和底层网络技术之间的耦合。 根据端到端…

基于SpringBoot+Vue前后端分离的学校心理健康测试系统

✌全网粉丝20W,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取项目下载方式&#x1f345; 一、项目背景介绍&#xff1a; 研究背景介绍&#xf…

花粉“不讲武德”,飞行途中公然使用卫星通话,严重违反民航规定

华为Mate 60 Pro/Pro推出卫星电话功能&#xff0c;华为终端BG CTO李小龙呼吁用户遵守飞行安全规定。 近日&#xff0c;华为推出了崭新的Mate 60 Pro/Pro手机系列&#xff0c;其中的卫星电话功能引起了广泛的热议。这款智能手机的卫星电话功能可与相关运营商的服务配合使用&…

LeetCode:长度最小的子数组

题目 给定一个含有 n 个正整数的数组和一个正整数 target 。 找出该数组中满足其总和大于等于 target 的长度最小的 连续子数组 [numsl, numsl1, …, numsr-1, numsr] &#xff0c;并返回其长度。如果不存在符合条件的子数组&#xff0c;返回 0 。 示例 1&#xff1a; 输入&…

AI大模型(LLM)、聊天机器人整理(持续更新)by pickmind

原文&#xff1a;https://blog.pickmind.xyz/article/3c87123f-d283-4a05-8e43-4ee8550cf22f 目录&#xff1a; 文章目录 国内获批大模型国内大模型深渊图Open-source Large Language Models Leaderboard&#xff08;国外&#xff09;lmsys发布的大模型排行榜&#xff08;国外…

Git命令拉取代码

流程 1在本地clone项目【保持与远程仓库一致】 此时已绑定远程仓库 git clone xxxx 2.添加文件 3.放到暂存区 git add 4.提交到本地仓库 git commint -m "提示信息" 5推送到远程仓库 git push origin master 其他命令 分支命令 分支就是每个人开发 互不影响…

Qt应用开发(基础篇)——组合框容器 QGroupBox

一、前言 QGroupBox继承于QWidget&#xff0c;是一个带有标题的组合框架容器控件。 QGroupBox组合框容器自带一个顶部标题&#xff0c;一个面板。面板内部展示各种各样的部件&#xff0c;标题用来解释这些部件为什么集合在一起&#xff0c;并且支持键盘快捷方式切换部件焦点。比…

中断(全网最细!)

什么是中断&#xff1f; 中断是让单片机具有处理外部和内部随机发生事件实时处理的能力&#xff1b; 中断提高了单片机处理外部或内部的能力&#xff1b; 芯片在处理某一个A事件&#xff0c;发生了一件B事件&#xff0c;请求芯片&#xff08;中断发生&#xff09;去处理B事件…

机器学习中岭回归、LASSO回归和弹性网络与损失函数

今天咱们来聊点纯技术的东西&#xff0c;这东西是基础&#xff0c;不说往后没法说&#xff0c;在机器学习领域中&#xff0c;我们可以通过正则化来防止过拟合&#xff0c;什么是正则化呢&#xff1f;常见的就是岭回归、LASSO回归和弹性网络。 先说说什么叫做过拟合&#xff1f…

Redis之SDS底层原理解读

目录 SDS是什么&#xff1f; SDS结构示例 概述 空间预分配 惰性空间释放 C字符串跟SDS的区别&#xff1f;为什么用SDS&#xff1f; SDS是什么&#xff1f; Redis 底层的程序语言是由 C 语言编写的&#xff0c;C 语言默认字符串则是以空字符结尾的字符数组&#xff08…

品牌价格调查的方法

品牌做价格调查的目的&#xff0c;不是简单的对页面价或者挂牌售价进行调查&#xff0c;基本是需要对商品的到手价进行调查的&#xff0c;调查渠道中的实际成交价对品牌来说意义重大&#xff0c;因为知道到手价就可以了解产品是否存在低价&#xff0c;进而可以做针对性的低价打…

冠达管理:元宇宙三年行动计划发布,高增长潜力股名单出炉

未来5年&#xff0c;国内元国际商场规划至少打破2000亿元大关。 金融监管总局9月10日发布《关于优化保险公司偿付能力监管规范的告诉》&#xff0c;优化保险公司偿付能力监管规范&#xff0c;自发布之日起施行。 金融监管总局释放重要利好&#xff0c;引导保险资金更大力度地…

Ruff南潮物联邀请您参观中国工博会,快来扫码领取免费门票!

由于受疫情影响的延期&#xff0c;第23届中国国际工业博览会&#xff08;简称"中国工博会"&#xff09;终于将要在2023年9月19日-23日国家会展中心&#xff08;上海虹桥&#xff09;举行。 中国工博会是由工业和信息化部、国家发展和改革委员会、科学技术部、商务部、…

教师节快乐!这条传承之路,我们走了十数年……

守初心&#xff0c;传匠心 这条路&#xff0c;我们走了十数年…… 在云和恩墨&#xff0c;有这样一群人&#xff0c;他们是技术和业务知识的传播布道者&#xff0c;乐知乐享&#xff0c;助人达己&#xff1b;他们在新人成长的道路上良苦用心&#xff0c;甘为人梯&#xff1b;他…

JTAG无法进入app的断点问题解决

通过JTAG口&#xff0c;可以对STM32进行在线调试&#xff0c;主要还是APP的调试&#xff0c;一般来说都是没有问题的。 但是&#xff0c;我这边碰到个奇怪现象&#xff1a; main 函数里面断点 死活进不去 官方demo程序也是一样现象 可以确定&#xff0c;App是正确写入到芯片的…

RBTree模拟实现

一、概念 概念&#xff1a;红黑树&#xff0c;是一种二叉搜索树&#xff0c;但在每个结点上增加一个存储位表示结点的颜色&#xff0c;可以是Red或 Black。 通过对任何一条从根到叶子的路径上各个结点着色方式的限制&#xff0c;红黑树确保没有一条路径会比其他路径长出俩倍&a…

【C#实战】控制台游戏 勇士斗恶龙(3)——营救公主以及结束界面

君兮_的个人主页 即使走的再远&#xff0c;也勿忘启程时的初心 C/C 游戏开发 Hello,米娜桑们&#xff0c;这里是君兮_&#xff0c;最近开始正式的步入学习游戏开发的正轨&#xff0c;想要通过写博客的方式来分享自己学到的知识和经验&#xff0c;这就是开设本专栏的目的。希望…