自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Dufre

Stay Hungry,Stay Foolish

  • 博客(8)
  • 问答 (2)
  • 收藏
  • 关注

原创 设计模式之单例模式实现(C++)

前言摘自:http://www.jellythink.com/archives/82 现在,不管开发一个多大的系统(至少我现在的部门是这样的),都会带一个日志功能;在实际开发过程中,会专门有一个日志模块,负责写日志,由于在系统的任何地方,我们都有可能要调用日志模块中的函数,进行写日志。那么,如何构造一个日志模块的实例呢?难道,每次new一个日志模块实例,写完日志,再delete,不要告诉我你是这么

2017-03-27 20:15:04 459

原创 Qt信号槽与观察者模式

qt的核心机制:信号与槽和设计模式中的观察者模式很类似。 https://www.devbean.net/2012/08/qt-study-road-2-custom-signal-slot 这篇文章讲的很详细,我这就算是做个笔记吧信号与槽信号和槽机制是 QT 的核心机制,它是qt自行定义的一种通信机制,独立于标准的 C/C++ 语言。信号与槽的机制,能够设计出解耦(模块化设计)的非常漂亮的程序

2017-03-20 21:59:37 6589

原创 qt获取IP、网关地址

最近由于项目需要使用socket通信,要获取网关地址,于是上网搜了一下 首先我们要添加iphlpapi.lib库,从而获得windows下一些基本的网络连接信息。 函数 作用 GetNumberOfInterfaces() 获取当前的网络接口数目 GetIfTable() 得到所有网络接口的信息 GetIpAddrTable() 获取ip到网络接口 GetIpNe

2017-03-17 20:42:10 10859

原创 leetcode No234. Palindrome Linked List

QuestionGiven a singly linked list, determine if it is a palindrome. 判断链表是否为回文Algorithm需要解决的问题: 1、找到中心的位置(一快一慢指针,快的一次走两步,慢的一次走一步) 2、以中心拆分链表,并反转后半部分的链表 (http://blog.csdn.net/u011391629/article/detai

2017-03-12 13:55:59 338

原创 leetcode No203. Remove Linked List Elements

QuestionRemove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5 去值为val的元素Algorithm法一:用两个指针,一个遍历,一

2017-03-09 20:28:18 620

原创 leetcode No237. Delete Node in a Linked List

QuestionWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with va

2017-03-09 15:40:02 404

原创 leetcode No141. Linked List Cycle

QuestionGiven a linked list, determine if it has a cycle in it. 判断链表是否有环Algorithm用两个指针,一快一慢,如果它们会在某一个地方相遇则证明有环Accepted Codeclass Solution {public: bool hasCycle(ListNode *head) { if(head=

2017-03-09 15:09:29 441

原创 leetcode No300. Longest Increasing Subsequence

QuestionGiven an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], t

2017-03-06 19:14:26 465

空空如也

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

TA关注的人

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