![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
fin0303
这个作者很懒,什么都没留下…
展开
-
leetcode 27 remove element
由于自己的算法实在太烂,所以不得不去学好,从最低的leetcode开始刷起,从简单干起。leetcode 27 remove elementGiven an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for a原创 2016-04-04 17:52:11 · 277 阅读 · 0 评论 -
数据结构复习-链表
##链表1、单链表什么是单链表?通过一组任意存储单元来存储线性表中的数据元素单链表的结构?一个数据域一个指针域 typedef stuctLNode{ ElemType data; struct LNode *next; }LNode,*LinkList结构体如上链表优点缺点?优点:插入和删除元素不需要移动其他原创 2016-03-27 16:42:17 · 438 阅读 · 0 评论 -
leetcode 80 Remove Duplicates from Sorted Array II
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons原创 2016-04-09 15:55:41 · 242 阅读 · 0 评论 -
leetcode Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right. The first integer of each row is原创 2016-04-09 21:16:46 · 280 阅读 · 0 评论 -
leetcode 118. Pascal's Triangle
Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]题目的意思是:给一个数值,返回一个帕斯卡三角思路,我们观察到规原创 2016-04-10 15:22:19 · 226 阅读 · 0 评论 -
leetcode 237. Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, t原创 2016-04-11 10:32:04 · 213 阅读 · 0 评论 -
leetcode 240. Search a 2D Matrix II
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right. Integers in each co原创 2016-04-11 10:51:01 · 228 阅读 · 0 评论 -
leetcode 88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional原创 2016-04-11 12:17:18 · 254 阅读 · 0 评论 -
排序算法-选择排序和插入排序比较(待续未完)
排序算法非常重要,在计算机中,计算机中排序数据占用的工作量有20%左右,所以研究排序算法有助于我们提高工作效率。排序算法的性能由以下几点决定 1.比较次数 2.交换次数 3.读写数组次数PS:对于不交换元素的算法,我们会计算访问数组次数。一.选择排序1.原理 找到数组最小的那个数,和第一个元素交换位置(如果第一个数是最小,就和自己交换),然后,在剩下元素当中,找到最小的数,和第二个数交换。如原创 2016-04-14 15:40:03 · 168 阅读 · 0 评论