![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
pczpcz8
这个作者很懒,什么都没留下…
展开
-
快速排序算法 - leetcode(148)排序链表
效率不是很高,还需要优化 /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ void quicksort(struct ListNode *pstart, struct ListNode *pend); s...原创 2020-01-11 11:51:09 · 314 阅读 · 0 评论 -
数据结构与算法(4)-- 图的链接表表示
图的链接表表示方法,C代码实现: #include <stdio.h> #include <stdlib.h> #define VNUMBER 20 typedef struct edges{ int val; int index; //边信息,index对应数组v[VNUMBER]的下标,表示这条边的其实节点 struct edges...原创 2020-01-11 11:16:08 · 447 阅读 · 0 评论 -
数据结构与算法(3)-- 堆排序
待补全~ #include <stdio.h> #include <stdlib.h> #define SIZE 10 #define HEAPSIZE 10 typedef struct heaps{ int a[SIZE]; int heapsize; }heap; heap *heapcreate() { heap *p = (heap *)mall...原创 2020-01-11 11:06:10 · 136 阅读 · 0 评论 -
数据结构与算法(2)-- 二叉查找树
1、二叉查找树的特点 (1) 右子树所有节点关键字的值都要大于左子树中的值; (2) 一般的情况:key[left[x]] < key[x] < key[right]; (3) 查询操作最坏情况O(n),平均情况O(lg(n)); 2、常见操作 (1) 插入操作:struct node * insert(struct node *root, struct node *new)...原创 2020-01-01 20:49:26 · 125 阅读 · 0 评论 -
数据结构与算法(1)--二叉树
博客记录的第一个算法: 实现二叉树数据结构,以及深度优先搜索和广度优先搜索算法(非科班小白,努力中。。。。) class BT_Node: def __init__(self, data, left = None, right = None): sel...原创 2019-07-18 19:23:44 · 77 阅读 · 0 评论 -
插入排序算法 - LeetCode (147) 对链表进行插入排序
执行结果:通过 执行用时 :392 ms, 在所有Python3提交中击败了64.92%的用户 内存消耗 :15.7 MB, 在所有Python3提交中击败了7.38%的用户 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x...原创 2019-08-13 14:40:33 · 106 阅读 · 0 评论