上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页
摘要: 本文仅为博主个人总结,水平有限,欢迎大神指出不妥处。 关于二叉树的相关概念可以参见二叉树的百度百科,或binary tree Wiki。 二叉树结点类的常见定义为: 提到二叉树,首先要提到二叉树的四种遍历方式:前序遍历、中序遍历、后续遍历和层次遍历,其中前三种为一类,一般是使用栈(stack)实现, 阅读全文
posted @ 2017-07-28 11:03 王大咩的图书馆 阅读(6269) 评论(0) 推荐(3) 编辑
摘要: 本文基于张尧学老师编写的《计算机操作系统教程(第4版)》第三章。 本文主要讲解如何引出进程这个概念。 现代操作系统的重要特点是在保证安全的前提下,程序并发执行,系统所拥有的资源被共享和系统的用户随机使用。采用一个什么样的概念来描述计算程序的执行过程和作为资源分配的基本单位,才能反映计算的特点了?这个 阅读全文
posted @ 2017-07-27 16:41 王大咩的图书馆 阅读(673) 评论(0) 推荐(0) 编辑
摘要: 一、若二叉树为搜索二叉树 原题链接:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/#/description Given a binary search tree (BST), find th 阅读全文
posted @ 2017-07-27 14:53 王大咩的图书馆 阅读(1087) 评论(0) 推荐(0) 编辑
摘要: 本文基于张尧学老师编著的《计算机操作系统教程(第4版)》第二章。 操作系统为用户提供两个接口:一、各种命令接口;二、系统调用。 一、各种命令接口 用户利用这些操作命令来组织和控制作业的执行或管理计算机系统。操作系统的命令控制界面就是用来组织和控制作业的执行的。主要有两种方式:脱机方式、联机方式。 脱 阅读全文
posted @ 2017-07-26 19:38 王大咩的图书馆 阅读(1026) 评论(0) 推荐(0) 编辑
摘要: 1、函数原型 注:在C++中,则存在于<cstring>头文件中。 2、函数功能: strcat(dest, src)把src所指字符串添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0'。 注:src和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串。另外 阅读全文
posted @ 2017-07-26 17:07 王大咩的图书馆 阅读(282) 评论(0) 推荐(0) 编辑
摘要: strcpy函数的百科中给出了各种情况的详细说明,这里,仅给出一些注意事项: 1、strcpy的函数原型是: 注:C++中strcpy函数在cstring头文件中,即:#include<cstring>。 2、功能: 将src地址开始且含有NULL结束符的字符串复制到以dest开始的地址空间中。 值 阅读全文
posted @ 2017-07-26 16:42 王大咩的图书馆 阅读(477) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
posted @ 2017-07-20 20:13 王大咩的图书馆 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Given an index k, return the k th row of the Pascal's triangle. For example, given k = 3,Return[1,3,3,1]. Note: Could you optimize your algorithm to u 阅读全文
posted @ 2017-07-20 16:35 王大咩的图书馆 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 题意:给定行数构建帕斯卡三角。 思路:注意行数和该行中列数的关系,还有每行中非首尾元素时,该元素 阅读全文
posted @ 2017-07-20 15:40 王大咩的图书馆 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Divide two integers without using multiplication, division and mod operator. 题意:两数相除不能用乘法、除、取余运算。 思路:直观的想法是相减,使用计算器p记下相减的次数n,这样时间复杂度为O(n)(n代表相减次数)。这是如 阅读全文
posted @ 2017-07-20 15:17 王大咩的图书馆 阅读(363) 评论(0) 推荐(0) 编辑
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given"25525511135", return["255 阅读全文
posted @ 2017-07-19 18:59 王大咩的图书馆 阅读(403) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2]have the following unique per 阅读全文
posted @ 2017-07-19 16:30 王大咩的图书馆 阅读(211) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers, return all possible permutations. For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3 阅读全文
posted @ 2017-07-19 15:59 王大咩的图书馆 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n). 题意:计算x的次方 思路:这题的思路和sqrt的类似,向二分靠近。例如求4^5,我们可以这样求:res=4、4*4^4。就是将每次在res的基础上乘以x本身,换成,每次以x*=x的方式前行,这样时间复杂度为O(logn),代码如下: 把x的n次方划分成两个x 阅读全文
posted @ 2017-07-19 14:46 王大咩的图书馆 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Implementint sqrt(int x). Compute and return the square root of x. 题意:求根号下x 的值 思路:使用二分搜索。先定义x平方根的取值区间,取值区间不同,在一些细节处理上也是不同的。这里去right为(x/2)+1,这是因为一个非负数x 阅读全文
posted @ 2017-07-19 10:48 王大咩的图书馆 阅读(1448) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页