# Data-structure-and-algorithm **Repository Path**: JxnuHxh/Data-structure-and-algorithm ## Basic Information - **Project Name**: Data-structure-and-algorithm - **Description**: 在这里开始我的算法之道,记录我写每一题的当时的思路 算法题主要来自 牛客 LeetCode 剑指Offer - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-18 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Data-structure-and-algorithm 在这里开始我的算法之道,记录我写每一题的当时的思路 1. 数组和矩阵 2. 字符串 3. 树 4. 哈希表 5. 栈和队列 6. 图 7. 位运算 8. 链表 ## 牛客网 ## leetcode ## 剑指Offer #### [04号二位数组中的查找](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer04.text) 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序, 每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数, 判断数组中是否含有该整数. #### [05号替换空格](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer05.text) 实现一个函数,把字符串中的每个空格替换成"%20"。 #### [06号 从尾到头打印链表](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer06.text) 输入一个链表的头节点,从尾到头反过来打印出每个节点的值 #### [07号 重建二叉树](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer07.text) 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。 假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入 前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回 #### [13号 机器人活动范围](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer13.text) 地上有一个m行和n列的方格。一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格, 但是不能进入行坐标和列坐标的数位之和大于k的格子。 例如,当k为18时,机器人能够进入方格(35,37) ,因为3+5+3+7 = 18。但是,它不能进入方格(35,38),因为3+5+3+8 = 19。 请问该机器人能够达到多少个格子 ? #### [55号 二叉树的深度](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer55.text) 输入一棵二叉树,求该树的深度。从根结点到叶结点依次经过的结点(含根、叶结点)形成树的一条路径, 最长路径的长度为树的深度。 #### [65号 不用加减乘除做加法](https://github.com/JxnuHxh/Data-structure-and-algorithm/blob/master/Data%20structure%20and%20algorithm/src/com/offer/offer65.text) 写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号