Algorithm notes
来源:互联网 发布:炉石淘宝买卡包安全吗 编辑:程序博客网 时间:2024/06/05 16:20
2013/03/31 Confirming a point is in a triangle (2D)
---------------------------------------------------------------------------------
Directed area formula :
| x0 y0 1 |
| x1 y1 1 | = 2A = x0*y1 + y0*x2 + y2*x1 - y1*x2 - y0*x1 - x0*y2
| x2 y2 1 |
("A" represents the area, (x0,y0) & (x1,y1) & (x2, y2) are points of the triangle.)
Assuming that (x,y) is the point we want to confirm, calculate area "B":
| x y 1 | | x0 y0 1 | | x0 y0 1 |
2B = | x1 y1 1 | + | x y 1 | + | x1 y1 1 | Then judge if 2B == 2A.
| x2 y2 1 | | x2 y2 1 | | x y 1 |
2013/03/30 Finding the longest palindrome substring
---------------------------------------------------------------------------------
Manacher algorithm :
The core idea is to fill the string with '#' like:
source string : abcccba
filled string : #a#b#c#c#c#b#a#
Then you can find the length of the filled string is always odd, so you needn't to consider the condition of even.
Store the middle position in the substring you are to judge and the radious the substring contains.
2013/03 Fibonacci solution by martix
2013/03 Hanoi recursion
2013/03 Binary GCD(Greatest common divisor)
- Algorithm notes
- Algorithm Study Notes
- Histgram Equalization Algorithm Notes
- Algorithm--Bucket Sort Notes,
- Study notes for Expectation Maximum Algorithm
- CS229 Lecture Notes(4): Generative Learning Algorithm
- Algorithm Notes (六)Linear List
- Programming Question-5-Dijkstra Algorithm via Min-Heap (including Notes)
- Notes
- notes
- Notes
- notes
- notes
- notes
- notes
- Notes
- notes
- Notes
- CodeForces 298A Snow Footprints
- C语言中用柔性数组实现斐波那契数列
- ogre开发环境快速搭建(成功率100%)
- cookie 和session 的区别详解
- Forward函数和sendRedirect函数
- Algorithm notes
- cocos2d-x 中 Sqlite3 事务(Transaction)操作
- 文件 I/O——open函数
- 排列2 + stl函数+ next_permutation()
- Spring事务杂谈
- UVaOJ674 - Coin Change
- 算法竞赛入门经典 快速排序和并归排序
- Oracle中常用的to_Char用法详解(有FMT的详细列表)
- centos6.2使用yum安装lamp