
数据结构
文章平均质量分 57
leowang2234
这个作者很懒,什么都没留下…
展开
-
数据结构之——单链表的增删改查
#include #include #include#define true 1#define false 0typedef int bool;typedef struct Node{ int val; struct Node * next;}NODE,*PNODE;//函数声明void traverse_list(PNODE pHead);PNODE原创 2016-10-25 22:21:39 · 3468 阅读 · 1 评论 -
数据结构之——栈的创建于基本操作
#include #include #include#define true 1#define false 0typedef int bool;typedef struct Node{ int val; struct Node * next;}NODE,*PNODE;typedef struct Stack{ PNODE pTop; PNO原创 2016-10-26 00:56:39 · 1748 阅读 · 0 评论 -
数据结构之——基于数组实现的循环队列
#include #include #include#define LEN 6 //定义队列的最大长度#define true 1#define false 0typedef int bool;//此队列为循环队列,基于数组实现typedef struct Queue{ int front; int rear; int * pBase;}原创 2016-10-27 14:57:25 · 587 阅读 · 0 评论 -
数据结构之——创建一棵二叉树并完成遍历
#include #include #define true 1#define false 0typedef int bool;typedef struct BiNode{ char data; struct BiNode * pLchild; struct BiNode * pRchild;}BiNode,*PBiNode;PBiNode creat原创 2016-10-28 20:56:07 · 1326 阅读 · 0 评论 -
数据结构之——快速排序
#include #include #define true 1#define false 0typedef int bool;//输入一个数组,进行快速排序后输出//快排子函数,输入参数为数组名和数组最小的下标和最大的下标//快速排序的实现依赖于递归,该首先确定了某个元素在序列中的位置后,将原序列分为左右两个部分,然后按照先左,再右的顺序进行递归void quick_sor原创 2016-10-28 22:29:43 · 595 阅读 · 0 评论 -
JAVA及相关字符集编码问题研究分享
原文地址在java应用软件中,会有多处涉及到字符集编码,有些地方需要进行正确的设置,有些地方需要进行一定程度的处理。本文主要给大家讲解java中字符的编码格式等相关问题一、前言 在分析Comparable和Comparator的时候,分析到了String类的compareTo方法,String底层是用char[]数组来存放元素,在比较的时候是比较的转载 2016-11-28 11:45:23 · 584 阅读 · 0 评论 -
判读一棵树是不是平衡二叉树
要求给定一棵二叉树,判断是否为平衡二叉树思路 总体思路是这样的 先分别判断左右子树是不是平衡的,若左右子树都是平衡二叉树,则判断左右子树的高度差是不是满足绝对值小于等于 1 的条件伪代码is_balanced_tree = true;void is_balance(root){ get_height(root) return is_balanced_tree;}g原创 2017-05-28 22:19:53 · 582 阅读 · 0 评论 -
一个序列中连续子序列的最大和
时间复杂度为 比狗n , 具体思路是:遍历一边数组元素 在遍历的同时,依次求和,若在当前位置求的和为负数,则舍弃,从下一个位置,重新开始,继续求和。在遍历求和的过程中,要比较当前位置和与最大值的比较,更新最大值。/** * 找到一个序列中,连续元素和的最大值 时间复杂度 为 O(n) */public class ContinusSequence { public static v原创 2017-05-29 02:42:44 · 706 阅读 · 0 评论 -
给定一定金额的钱,求换得后的硬币个数最少
/** * * 拥有不同面值的货币,求,换一定面值的钱,用的货币的 数目 最少 * */public class MakingChange { static int[] history = null; public static void main(String[] args) { int[] coinKinds = {1, 3, 5}; // 货币的种类,与原创 2017-05-29 02:38:22 · 1267 阅读 · 0 评论