自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(352)
  • 资源 (8)
  • 收藏
  • 关注

原创 [LeetCode-20] Valid Parentheses(用栈解决配对问题)

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va

2015-10-22 11:25:08 620

原创 [LeetCode-225] Implement Stack using Queues(两个队列实现栈)

Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return whet

2015-10-21 18:07:39 868

原创 [LeetCode-232] Implement Queue using Stacks(两个栈实现一个队列)

Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(

2015-10-21 14:23:34 784

原创 堆栈顺序存储和 free 失败原因分析

*** Error in `./a.out': free(): invalid pointer: 0x09e7c018 ***======= Backtrace: =========/lib/i386-linux-gnu/libc.so.6(+0x767c2)[0xb76307c2]/lib/i386-linux-gnu/libc.so.6(+0x77510)[0xb7631510]./a

2015-10-19 17:20:08 2028

原创 中断服务函数能不能带形参和返回值?

概述从本质上来讲,中断是一种电信号,当设备有某种事件发生时,它就会产生中断,通过总线把电信号发送给中断控制器。如果中断的线是激活的,中断控制器就把电信号发送给处理器的某个特定引脚。处理器于是立即停止自己正在做的事,跳到中断处理程序的入口点,进行中断处理。(1) 硬中断由与系统相连的外设(比如网卡、硬盘)自动产生的。主要是用来通知操作系统系统

2015-10-19 14:30:47 21115

原创 [LeetCode-155] Min Stack(设计一个 min 函数栈)

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get

2015-10-19 10:06:26 618

原创 [LeetCode-58] Length of Last Word(最后一个单词长度)

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2015-10-15 14:05:39 2370

原创 [LeetCode-82] Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1-

2015-10-14 08:46:27 490

原创 [LeetCode-83] Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.【分析】从将有序链表中的重复元素删除[

2015-10-13 21:33:48 346

原创 [LeetCode-80] Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first fi

2015-10-13 21:09:45 356

原创 [LeetCode-26] Remove Duplicates from Sorted Array(移除数组重复元素)

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

2015-10-13 20:52:25 424

原创 [LeetCode-268] Missing Number(找缺失的数字)

找到数组中缺失数:分以下两种解法:①输入数组是有序数组②输入数组是无序数组。输入的数组是一个无序数组(当缺失添加进输入时,排序后是一个等差数列,公差为1),找到缺失数,题目要求时间复杂度为n,所以想先将数组排序的想法肯定不实际,由题意,大小为n的数组里的所有数都是0 - n之间的数,无需数组,我们首先遍历一遍记录最大、最小值以及实际数组和,用最小值到最大值相加之后得到的期望数组和减去实际数组和,就是缺失的整数。【输入的数组是一个有序数组,找到缺失数,题目要求时间复杂度为n,由题意,大小为n的数组里的所有数都

2015-10-12 17:04:55 867

原创 [LeetCode-258] Add Digits(非负整数各位相加)

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on

2015-10-11 10:44:14 2142 1

原创 [LeetCode-92] Reverse Linked List II(反转指定区间链表)

【分析】反转链表,但不是从头到尾的反转,给定了一个[m,n]范围,反转指定区间的链表。1 ≤ m ≤ n ≤ length of list.不满足条件的话,返回原链表

2015-10-10 09:41:28 815

原创 Linux Shell 之 Shell 基本控制结构(二)(循环结构)

与其他编程语言类似,Shell支持for循环,和while 循环。1、for 循环for循环一般格式为: for 变量 in 列表docommand1command2...commandNdone列表是一组值(数字、字符串等)组成的序列,每个值通过空格分隔。每循环一次,就将列表中的下一个值赋给变量。in 列表是可选的,如果不用它,for 循环使用命令

2015-10-09 20:00:08 730

原创 [Leetcode-142] Linked List Cycle II(链表有环详细分析)

环的长度是多少?如何找到环中第一个节点(即Linked List Cycle II)?如何将有环的链表变成单链表(解除环)?如何判断两个单链表是否有交点?如何找到第一个相交的节点?

2015-10-09 09:33:42 3660 7

原创 [LeetCode-141] Linked List Cycle(判断链表是否有环)

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?【分析】关于这个问题可以参考http://leonax.net/p/1960/find-circle-in-linked-list/。由于每一个父亲只有可能

2015-10-08 22:33:41 2061 1

原创 [LeetCode-234] Palindrome Linked List(回文链表、链表中间节点查找)

Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?【分析】找到链表中点,拆分后,逆转后半个链表,然后两个链表同时顺序遍历一次。不过唯一需要注意的是,当链表长度为奇数,我们需要先将链表中点

2015-10-08 21:46:57 670

原创 [LeetCode-160] Intersection of Two Linked Lists(找到两链表公共交叉点)

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2015-10-07 17:21:16 503

原创 Linux Shell 之 Shell 基本控制结构(一)(if and case)

1、条件分支if 语句通过关系运算符判断表达式的真假来决定执行哪个分支。Shell 有三种 if ... else 语句:if ... fi 语句; if ... else ... fi 语句; if ... elif ... else ... fi 语句。 1) if ... else 语句if ... else 语句的语法:if [ expression ]t

2015-10-06 20:46:55 1924

原创 Linux Shell 之 Shell 数组建立与使用

bash支持一维数组(不支持多维数组),并且没有限定数组的大小。类似与C语言,数组元素的下标由0开始编号。获取数组中的元素要利用下标,下标可以是整数或算术表达式,其值应大于或等于0。1、定义数组在Shell中,用括号来表示数组,数组元素用“空格”符号分割开。定义数组的一般形式为:array_name=(value1 ... valuen)例如:array_name=(val

2015-10-06 17:00:13 669

原创 [LeetCode-172] Factorial Trailing Zeroes(n 阶乘后面有几个0)

Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.【分析】只有2和5相乘才会出现0,其中整十也可以看做是2和5相乘的结果,所以,可以在n之前看看有多少个2以及多少个5就行了,又发

2015-10-06 16:10:32 569

原创 [LeetCode-171] Excel Sheet Column Number(26进制转10进制)

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...

2015-10-06 15:57:58 537

原创 [LeetCode-169] Majority Element(找出数组中超过一半元素)

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2015-10-06 15:45:39 1499

原创 [LeetCode-168] Excel Sheet Column Title(10进制转26进制)

Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB Excel序是

2015-10-06 15:11:19 1362

原创 Linux Shell 之 Shell 打印命令

1、echo 命令 echo是Shell的一个内部指令,用于在屏幕上打印出指定的字符串。命令格式:echo arg您可以使用echo实现更复杂的输出格式控制。显示转义字符"echo "\"It is a test\""结果将是:"It is a test"双引号也可以省略。 显示变量name="OK"echo "$name It is a test"结果将是:OK It is

2015-10-02 10:03:03 5881

原创 Linux Shell 之 Shell 字符串操作

1、引言字符串是shell编程中最常用最有用的数据类型(除了数字和字符串,也没啥其它类型好用了),字符串可以用单引号,也可以用双引号,也可以不用引号。单双引号的区别跟PHP类似。单引号str='this is a string'单引号字符串的限制: 单引号里的任何字符都会原样输出,单引号字符串中的变量是无效的; 单引号字串中不能出现单引号(对单引号使

2015-10-01 21:38:44 718

原创 [LeetCode-34] Search for a Range (寻找有序数组中关键值的索引范围)

系统输入参数必须要做判断输入数组的长度和自己求解出来数组的长度不一致 int numslen= sizeof(nums)/sizeof(int); numsize !=numslen; /*这里特别奇怪*/二分法边界问题,low 和 high 循环条件和关键值 target 比较是用>= 还是用 > 问题数组是降序还是增序(本题不做要求,输入都是增序的数组)

2015-09-30 11:27:51 820

原创 [LeetCode-35] Search Insert Position(二分法)

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.

2015-09-29 15:28:40 526

原创 [LeetCode-278] First Bad Version(二分法注意事项)

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the

2015-09-29 14:58:42 2411

原创 Linux Shell 之 Shell 运算符

Bash 支持很多运算符,包括算数运算符、关系运算符、布尔运算符、字符串运算符和文件测试运算符。原生bash不支持简单的数学运算,但是可以通过其他命令来实现,例如 awk 和 expr,expr 最常用。1、算术运算符expr 是一款表达式计算工具,使用它能完成表达式的求值操作。#!/bin/bashval=`expr 2 + 2`echo "Total value

2015-09-29 10:49:25 864

原创 [LeetCode-27] Remove Element(从数组删除指定的元素)

Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn’t matter what you leave beyond the new length. 【分析】该题目和

2015-09-28 21:46:45 568

原创 [LeetCode-283] Move Zeroes(移动零元素)

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct

2015-09-28 21:26:52 942

原创 Source Insight has not been installed completely 解决简易办法

问题如上图描述所示,这个问题耽误了我很多时间,卸载了重新安装,安装了又卸载,在网上找个几个安装软件,都报相同的错误,问题依旧。问题造成原因:应该是第一次软件没有安装成功,造成以后安装都失败(本质原因,我也不清楚) 解决办法: 网上有人说需要用管理员权限执行,这个办法我试过了,不行。下载一个CCleaner 类似清理系统注册表的软件,先把软件先卸载一下,然后清理注册表,再重新安装一遍,这个问题解决

2015-09-28 20:59:09 6346

原创 Linux Shell 之 Shell 变量

1、引言shell变量是弱类型,支持自定义变量声明变量不用声明类型可以存储不同类型的内容使用时要明确变量的类型区分大小写变量类型运行shell时,会同时存在三种变量:1) 局部变量局部变量在脚本或命令中定义,仅在当前shell实例中有效,其他shell启动的程序不能访问局部变量。2) 环境变量所有的程序,包括shell启动的程序,都能访问环境变量

2015-09-28 19:29:01 600

原创 Linux Shell 之 Shell 脚本概述

1、引言Shell本身是一个用C语言编写的程序,它是用户使用Unix/Linux的桥梁,用户的大部分工作都是通过Shell完成的。Shell既是一种命令语言,又是一种程序设计语言。作为命令语言,它交互式地解释和执行用户输入的命令;作为程序设计语言,它定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。Shell 有两种执行命令的方式: 交互式(Interac

2015-09-28 16:35:51 1387 1

原创 主页老是被篡改解决办法

点击“开始”→”运行”,输入”gpedit.msc”,进入系统的组策略,选择“用户配置→Windows设置”→“Internet Explorer维护”里面的”URL→双击右侧窗口中的”重要URL”→选择”自定义主页URL”,在”主页URL”输入预设的网页地址,设置完成后退出即可。 主页设置好以后,如果不希望他人对自己设置的IE主页随意更改,可以禁用更改主页的设置。 开始-运行-输入“gpedit

2015-09-25 16:44:51 3104

转载 Linux 内核链表

操作系统内核常需要维护数据结构的链表。Linux 内核已经同时有几个链表实现。为减少复制代码的数量, 内核已经创建了一个标准环形双向链表,并鼓励需要操作链表的人使用这个设施.使用链表接口时,应当记住列表函数没做加锁。若驱动可能同一个列表并发操作,就必须实现一个锁方案。为使用链表机制,驱动必须包含文件  ,它定义了一个简单的list_head 类型 结构:点击(此处)折叠或打

2015-09-24 15:49:55 768

原创 Linux 进程与进程调度详解

进程调度发生在什么时机呢?这与引起进程调度的原因以及进程调度的方式有关。引起进程调度的原因有以下几类,(1)正在执行的进程执行完毕。这时,如果不选择新的就绪进程执行,将浪费处理机资源。(2)执行中进程自己调用阻塞原语将白己阻塞起来进入睡眠等状态。(3)执行中进程调用了P原语操作,从而因资源不足而被阻塞;或调用了v原语操作激活了等待资源的进程队列。(4)执行中进程提出I/O请求后被阻塞。(5)在分时系统中时

2015-09-24 15:37:41 3081

原创 Linux 文件系统底层实现

1、引言Linux文件管理从用户的层面介绍了Linux管理文件的方式。Linux有一个树状结构来组织文件。树的顶端为根目录(/),节点为目录,而末端的叶子为包含数据的文件。当我们给出一个文件的完整路径时,我们从根目录出发,经过沿途各个目录,最终到达文件。我们可以对文件进行许多操作,比如打开和读写。在Linux文件管理相关命令中,我们看到许多对文件进行操作的命令。它们大都基于对文件的打开和读写操作。比

2015-09-21 12:22:41 4491

GP接口函数描述和入参解析

GP接口函数描述和入参解析(持续完善中)。 目前已经涵盖:安全存储相关API,基础API和key相关的API正在完善,后续会补录上去,有需要的同学可以通过CSDN 私信我,单独发你。 函数分析:主要基于optee-os GP相关接口做分析的。

2022-05-04

TCG_TSS_Overview_Common_Structures_v0.9_r03_published

TPM-TSS协议栈

2022-03-20

Linux 设备模型之kobject

kobject_init用来初始化kobject结构,kobject_add用来把kobj加入到设备模型之中。 在实作中,我们先对obj1进行初始化和添加的动作,调用参数里,parent被赋为NULL,表示obj1没有父对象,反映到sysfs里, my_kobj1的目录会出现在/sys下,obj2的父对象设定为obj1,那么my_kobj2的目录会出现在/sys/my_kobj1下面。 前面提到,kobject也提供了引用计数的功能,虽然本质上是利用kref,但也提供了另外的接口供用户使用。 kobject_init_and_add和kobject_init这两个函数被调用后,kobj的引用计数会初始化为1, 所以在module_exit时要记得用kobject_put来释放引用计数。

2015-06-08

Linux下安装神器

Linux下的安装windows exe的神器。

2015-05-22

字符设备LED驱动程序

 所有的驱动程序都应该对应一个具体的设备,这个LED驱动当然设备应该是LED。但是linux将它分成了一类叫做混杂设备。这类设备共享一个主设备号,但次设备号不同所有混杂设备形成一个链表,要访问一个设备时根据次设备号来查找相应的miscdevice。linux中用struct miscdevice来描述一个混杂设备:

2015-04-14

Windows下基于socket多线程并发通信的实现

本文介绍了在Windows 操作系统下基于TCP/IP 协议Socket 套接口的通信机制以及多线程编程知识与技巧,并给出多线程方式实现多用户与服务端(C/S)并发通信模型的详细算法,最后展现了用C++编写的多用户与服务器通信的应用实例并附有程序。 关键词:Windows;套接字;多线程;并发服务器; Socket 是建立在传输层协议(主要是TCP 和UDP)上的一种套接字规范,最初由美国加州Berkley 大学提出,为UNIX 系统开发的网络通信接口,它定义了两台计算机之间通信的规范,socket 屏蔽了底层通信软件和具体操作系统的差异,使得任何两台安装了TCP 协议软件和实现了Socket 规范的计算机之间的通信成为可能,Socket 接口是TCP/IP 网络最为通用的应用接口,也是在Internet 上进行网络程序应用开发最通用的API[1],本文介绍了Socket通信的基本机制以及采用多线程技术实现并发通信的基本原理,并给出实例。

2015-04-07

采温显示存储报警模块

一些常用模块,包括LCD1602显示模块,DS1302模块,DS18B20模块,报警模块,24C02模块,全都是用C语言编写的。全部都通过调试,很方便的。很实用喔。。个人觉得3分并不贵啦,物有所值。。

2013-04-02

matlab基础教学

挺好的一个资源,我从老师那拷贝过来的,与大家分享了,内容很详细!

2011-10-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除