随笔分类 -  数据结构---线性表

摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 typedef int ElemType; 4 typedef struct DNode{ 5 ElemType data; 6 struct DNode *prior,*next; 7 }DNode,*DLi 阅读全文
posted @ 2020-03-21 14:51 wydxry 阅读(541) 评论(0) 推荐(0) 编辑
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 typedef int ElemType; 4 typedef struct LNode{ 5 ElemType data; 6 struct LNode *next; 7 }LNode,*LinkList; 阅读全文
posted @ 2020-03-21 14:45 wydxry 阅读(390) 评论(0) 推荐(0) 编辑
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 #define MaxSize 50 4 typedef int ElemType; 5 //静态分配 6 typedef struct{ 7 ElemType data[MaxSize]; 8 int len 阅读全文
posted @ 2020-03-21 14:39 wydxry 阅读(358) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/ 找出数组中重复的数字。 在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了 阅读全文
posted @ 2020-03-04 00:01 wydxry 阅读(179) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/cong-wei-dao-tou-da-yin-lian-biao-lcof/ 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 输入:head = [1,3,2]输出:[2,3,1] 限制: 阅读全文
posted @ 2020-03-03 23:23 wydxry 阅读(347) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-09-26 23:18 wydxry 阅读(12) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/transpose-matrix/ 给定一个矩阵 A, 返回 A 的转置矩阵。 矩阵的转置是指将矩阵的主对角线翻转,交换矩阵的行索引与列索引。 示例 1: 输入:[[1,2,3],[4,5,6],[7,8,9]]输出:[[1 阅读全文
posted @ 2019-09-26 22:48 wydxry 阅读(165) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/squares-of-a-sorted-array/ 给定一个按非递减顺序排序的整数数组 A,返回每个数字的平方组成的新数组,要求也按非递减顺序排序。 示例 1: 输入:[-4,-1,0,3,10]输出:[0,1,9,16, 阅读全文
posted @ 2019-09-26 22:40 wydxry 阅读(169) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/move-zeroes/ 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 示例: 输入: [0,1,0,3,12]输出: [1,3,12,0,0] 思路:把非零元素前移最后补零 阅读全文
posted @ 2019-09-25 23:12 wydxry 阅读(150) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/contains-duplicate/ 给定一个整数数组,判断是否存在重复元素。 如果任何值在数组中出现至少两次,函数返回 true。如果数组中每个元素都不相同,则返回 false。 示例 1: 输入: [1,2,3,1]输 阅读全文
posted @ 2019-09-25 23:06 wydxry 阅读(125) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/rotate-image/ 给定一个 n × n 的二维矩阵表示一个图像。 将图像顺时针旋转 90 度。 说明: 你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要使用另一个矩阵来旋转图像。 示例 1: 给定 阅读全文
posted @ 2019-09-25 12:30 wydxry 阅读(229) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/search-insert-position/ 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 你可以假设数组中无重复元素。 示例 1: 输入: [1 阅读全文
posted @ 2019-09-24 22:53 wydxry 阅读(356) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/remove-element/ 给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条 阅读全文
posted @ 2019-09-24 22:26 wydxry 阅读(161) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/intersection-of-two-linked-lists/ 编写一个程序,找到两个单链表相交的起始节点。 如下面的两个链表: 在节点 c1 开始相交。 输入:intersectVal = 8, listA = [4, 阅读全文
posted @ 2019-08-25 17:48 wydxry 阅读(856) 评论(0) 推荐(0) 编辑
摘要:题目链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/ 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并 阅读全文
posted @ 2019-08-17 20:06 wydxry 阅读(241) 评论(0) 推荐(0) 编辑

Live2D