码迷,mamicode.com
首页 >  
搜索关键字:two pointer    ( 13796个结果
LeetCode OJ - Same Tree
题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical...
分类:其他好文   时间:2014-05-23 12:40:21    阅读次数:352
LeetCode OJ - Recover Binary Search Tree
题目:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space ...
分类:其他好文   时间:2014-05-23 11:31:51    阅读次数:299
leetcode -day18 Balanced Binary Tree
1、 ?? Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subt...
分类:其他好文   时间:2014-05-23 08:19:19    阅读次数:282
【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...
分类:其他好文   时间:2014-05-23 07:43:23    阅读次数:246
c语言中指针悬空
指针悬空 指针悬空在我们使用指针的时候很容易被忽视,主要的表现是:指针所指向的内存 释放,指针并没有置为NULL,致使一个不可控制的指针。 #include #include int *pointer; void func() { int n=8; pointer=&n; printf("pointer point data is %d\n",...
分类:编程语言   时间:2014-05-22 09:03:09    阅读次数:371
System V信号量(1)
信号量和P、V原语由Dijkstra(迪杰斯特拉)提出 信号量 互斥:P、V在同一个进程中 同步:P、V在不同进程中 信号量值含义 S>0:S表示可用资源的个数 S=0:表示无可用资源,无等待进程 S 信号量 struct semaphore { int value; pointer_PCB queue; } P原语 P(s) ...
分类:其他好文   时间:2014-05-22 07:01:59    阅读次数:319
UVA 12123 - Magnetic Train Tracks(计数问题)
题目链接:12123 - Magnetic Train Tracks 题意:给定n个点,求有几个锐角三角形。 思路:和UVA 11529是同类的题,枚举一个做原点,然后剩下点根据这个原点进行极角排序,然后利用two pointer去遍历一遍,找出角度小于90度的锐角,然后扣掉这些得到钝角三角形的个数,然后在用总情况去扣掉钝角就是锐角或直角 代码: #include #include #...
分类:Web程序   时间:2014-05-20 14:10:56    阅读次数:412
Leetcode:Add Binary
戳我去解题Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".分析:高精度加法,只是将10进制的高精度加法 换成了 2进制的高精度加法首先将 两个...
分类:其他好文   时间:2014-05-20 11:21:52    阅读次数:224
Leetcode:Same Tree
戳我去解题Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identic...
分类:其他好文   时间:2014-05-20 10:09:37    阅读次数:201
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.分析:直...
分类:其他好文   时间:2014-05-20 08:52:09    阅读次数:277
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!