一、Comparable接口, Collections类 List的常用算法: sort(List); 排序,如果需要对自定义的类进行排序, 那就必须要让其实现Comparable接口, 实现比较两个类大小的方法 shuffle(List); 随机排列 void reverse(List); 逆序排 ...
分类:
编程语言 时间:
2017-07-28 23:51:43
阅读次数:
264
【114-Flatten Binary Tree to Linked List(二叉树转单链表)】 【LeetCode-面试算法经典-Java实现】【全部题目文件夹索引】 原题 Given a binary tree, flatten it to a linked list in-place. Fo ...
分类:
编程语言 时间:
2017-07-28 20:58:05
阅读次数:
215
Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length ...
分类:
其他好文 时间:
2017-07-28 12:51:18
阅读次数:
147
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa ...
分类:
其他好文 时间:
2017-07-27 21:23:50
阅读次数:
133
二叉排序树(Binary Sort Tree),又称二叉查找树。 1、若左子树不为空,则左子树上所有结点的值均小于他的根结构的值; 2、若右子树不为空,则右子树上所有结点的值均大于他的根结构的值; 3、他的左、右子树也分别为二叉排序树。 使用中序遍历时,二叉排序树的输出顺序是由小到大的有序数列。 二 ...
分类:
编程语言 时间:
2017-07-27 20:28:24
阅读次数:
188
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n ...
分类:
其他好文 时间:
2017-07-27 18:37:54
阅读次数:
163
一、若二叉树为搜索二叉树 原题链接:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/#/description Given a binary search tree (BST), find th ...
分类:
其他好文 时间:
2017-07-27 15:54:31
阅读次数:
170
整理一波c读写文件的API。 fopen 打开模式有以下几种: In order to open a file as a binary file, a "b"character has to be included in the mode string. fread Reads an array o ...
分类:
其他好文 时间:
2017-07-27 12:39:54
阅读次数:
138
select * from goods; a char(10):='三星' --定长字符串 b varchar2(10):='三星'; --可变字符串 c binary_integer:='10001'; --带符号整数,为整数计算优化性能 d number(5,2):='123.45'; --..... ...
分类:
数据库 时间:
2017-07-26 23:42:03
阅读次数:
266
将二叉查找树转化成双向链表 题目思路其实不难 ,中序遍历,然后再依次的将数据放入链表中即可 重点:新加元素前后链的配置 有个有意思的地方在于result没有赋初值 导致写代码时需要先初始化 然后删除之 。 在大数据量的情况下 有可能会爆栈 下一步想想如何用非递归的方法实现之 占坑 ...
分类:
其他好文 时间:
2017-07-26 20:21:12
阅读次数:
116