自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

TTc 's share

focus

  • 博客(35)
  • 资源 (8)
  • 收藏
  • 关注

转载 X-Y Problem

X-Y Problem对于X-Y Problem的意思如下:1)有人想解决问题X2)他觉得Y可能是解决X问题的方法3)但是他不知道Y应该怎么做4)于是他去问别人Y应该怎么做?简而言之,没有去问怎么解决问题X,而是去问解决方案Y应该怎么去实现和操作。于是乎:1)热心的人们帮助并告诉这个人Y应该怎么搞,但是大家都觉得Y这个方案有点怪异。2)在经过

2015-06-26 13:47:02 914 2

原创 C实现 LeetCode->Partition List(双指针大法)(单链表)

/** *  Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in

2015-06-22 20:24:11 471

原创 C实现 LeetCode->Insertion Sort List(排序)(单链表)

/** *  Sort a linked list using insertion sort.    二重循环 *///// InsertionSortList.c// Algorithms//// Created by TTc on 15/6/22.// Copyright (c) 2015年 TTc. All rights reserved.

2015-06-22 19:18:22 619

原创 C实现 LeetCode->Reorder List (双指针大法)(单链表是否有环)

/** *  Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values.    For example, Given {1,2,3,

2015-06-22 18:30:55 559

原创 C实现 LeetCode->Linked List Cycle 双指针大法)(单链表是否有环 并计算环长度)

1.如何判断是否有环?如果有两个头结点指针,一个走的快,一个走的慢,那么若干步以后,快的指针总会超过慢的指针一圈。2.如何计算环的长度?第一次相遇(超一圈)时开始计数,第二次相遇时停止计数。3.如何判断环的入口点:碰撞点p到连接点的距离=头指针到连接点的距离,因此,分别从碰撞点、头指针开始走,相遇的那个点就是连接点。//// LinkedListCycleII.

2015-06-22 17:32:47 699

原创 C实现 LeetCode->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?//判断一个链表是否为循环链表;  双指针大法(一快一慢)//// LinkedListCycle.c// Algo

2015-06-22 17:26:23 611

原创 C实现 LeetCode->Reverse Linked List (双指针大法)(单链表反转)

Reverse a singly linked list./** *  Reverse a singly linked list   反转单链表,请牢记 Reverse()函数 *///// ReverseLinkedList.c// Algorithms//// Created by TTc on 15/6/22.// Copyr

2015-06-22 15:04:25 1275

原创 C实现 LeetCode->Reverse Linked List II (双指针大法)(单链表反转)

Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n satisfy t

2015-06-22 14:04:58 790

原创 C实现 LeetCode->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-06-22 13:01:23 649

原创 C实现 LeetCode->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.    1: 输入已经排好

2015-06-22 11:48:49 501

原创 C实现 LeetCode->Rotate List(双指针大法)(单链表 部分旋转)

Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL.   双指针,没什么难点。//// RotateLi

2015-06-22 11:38:55 476

原创 C实现 LeetCode->Reverse Nodes in k-Group (双指针大法)(单链表反转)

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is

2015-06-22 11:24:57 741

原创 C实现 LeetCode->Merge Two Sorted Lists (双指针大法)(单链表swap合并反转)

Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y

2015-06-19 11:36:07 527

原创 C实现 LeetCode->Merge Two Sorted Lists (双指针大法)

Sort a linked list in O(n log n) time using constant space complexity. *   将单链表排序   O(n lg n)  //// SortList.c// Algorithms//// Created by TTc on 15/6/18.// Copyright (c

2015-06-18 12:02:05 879

原创 C实现 LeetCode->Merge k Sorted Lists (双指针大法)

Merge k Sorted Lists Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 把所有数据放到一个数组里面排序,然后再根据结果生成新的链表。//// MergeKSortedL

2015-06-18 11:47:55 640

原创 C实现 LeetCode->Merge Two Sorted Lists (双指针大法) (单链表排序)

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.双指针大法 解决//// MergeTwoSort

2015-06-18 10:45:47 562

原创 Lua lib 加载分析

String Lib 加载部分-----------------------------以 string lib 为例,加载代码如下:LUAMOD_API int luaopen_string (lua_State *L) { luaL_newlib(L, strlib); createmetatable(L); return 1;}函数主要有 2 行,luaL_n

2015-06-17 15:09:33 843

原创 LeetCode 之K-Sum 问题(个人理解) 双指针大法(总结)

做过leetcode的人都知道, 里面有2sum, 3sum(closest), 4sum等问题, 这些也是面试里面经典的问题, 考察是否能够合理利用排序这个性质, 一步一步得到高效的算法. 经过总结, 本人觉得这些问题都可以使用一个通用的K sum求和问题加以概括消化, 这里我们先直接给出K Sum的问题描述和算法(递归解法), 然后将这个一般性的方法套用到具体的K, 比如leetcode中

2015-06-17 10:29:27 2327

原创 C实现 LeetCode->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 vali

2015-06-17 09:51:23 875

原创 该怎样理解 Lua 逻辑运算符 and 和 or 的设计?

我想这个应该是和“短路求值”相关。因为:a and b: 如果a为false,那么b的结果是false还是true已经不重要,因为整个表达式的结果已经是false了,所以直接返回a就可以了同理,a or b:如果a为true,那么b的结果是false还是true已经不重要,因为整个表达式的结果已经是true了,所以直接返回a就可以了这是一种优化,避免不必

2015-06-16 14:53:47 548

原创 C实现 LeetCode->RemoveNthNodeFromEndofList

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the

2015-06-16 11:08:43 453

原创 C实现 LeetCode->4Sum

Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Element

2015-06-15 11:19:58 369

原创 C实现 LeetCode->3SumClosest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact

2015-06-15 10:10:32 555

原创 C实现 LeetCode->3Sum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.1:给定一个 整形数组S 里面的元素 满足 a+b+C =0 ;2:满足a

2015-06-12 11:19:09 556

原创 C实现 LeetCode->LongestCommonPrefix

Write a function to find the longest common prefix string amongst an array of strings.Show Tag编写一个函数查找最长公共前缀字符串在字符串数组。

2015-06-12 10:34:48 514

原创 C实现 LeetCode->Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.罗马字符串转换为 int int romanToInt(char* s) { int map[256] = { 0 }; map['I

2015-06-11 11:30:49 422

原创 C实现 LeetCode->Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.将一个 整形转换为 罗马字符  int范围(1-3999)//// IntegerToRoman.c// Algorit

2015-06-11 11:26:45 484

原创 C实现 LeetCode->Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321反转整形主要是注意边界条件1:   如果整数的最后一位为0,应该输出什么?例如,如100。    2: 逆转整数可能溢出;假设输入是一个32位整数

2015-06-11 10:21:41 410

原创 C实现 LeetCode->Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.判断一个 整形是不是 回文,不能使用额外的空间 扩展 :(判断 一个字符串是不是回文  ;一个单链表是不是回文;一个栈是不是回文)//// PalindromeNumber.c/

2015-06-11 10:16:58 135

原创 C实现 LeetCode->Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.回文,英文palin

2015-06-06 18:13:36 432

原创 C实现 LeetCode->Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo

2015-06-06 16:25:09 411

原创 动态规划算法Dynamic Programming

/** *  动态规划算法  Dynamic Programming = Divide and Conquer + Memoization  动态规划是分治法的延伸。当递归分割出来的问题,一而再、再而三出现,就运用记忆法储存这些问题的答案,避免重复求解,以空间换取时间。  动态规划的过程,就是反覆地读取数据、计算数据、储存数据。  1: 动态规划算法一般用来求解

2015-06-05 14:06:44 1209

转载 为什么很多大牛在写题的时候要加一堆宏?

给你说几个 inline 无法代替宏的地方:1. 循环展开:// loop unroll double#define LOOP_UNROLL_DOUBLE(action, actionx2, width) do { \ unsigned long __width = (unsigned long)(width); \ unsigned long __increment

2015-06-05 09:05:46 869

原创 C实现 LeetCode->Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link

2015-06-04 15:18:58 507

原创 C实现 LeetCode-> TwoSum

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 numbers such that they add up to the target, whe

2015-06-04 15:13:04 477

pthread源代码

posix linux环境下的pthread source 通过查看源代码可以对线程的认识更加深刻 你知道吗?线程的底层实现也是调用clone[创建进程] 故有线程是轻量级的进程

2015-05-15

西蒙教程13章

西蒙教程全部13章中文教程下载,全部13章哦,opengles入门从这开始哦

2012-09-16

西蒙教程源代码(全部17章)

西蒙教程的17章全部源代码,全部的17章阿

2012-09-16

cocos2d _切水果

COCOS2D_IPHONE 切水果实例, 游戏

2012-09-06

ios翻页特效demo

一种IOS 翻页特效demo,折页效果,3d翻页效果

2012-08-14

fbreader 电子阅读

android系统下的一款开源阅读器代码,支持EPUB,TXT,UMD,FB2文件格式

2012-08-14

EPUB 解析 (java)

java实现的EPUB 解析模块,从开源项目FBreader中优化出来的模块代码

2012-08-14

空空如也

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

TA关注的人

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