-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
370 lines (250 loc) · 25.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Shiyi's blog</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description">
<meta property="og:type" content="website">
<meta property="og:title" content="Shiyi's blog">
<meta property="og:url" content="http://zhoushiyi.com/index.html">
<meta property="og:site_name" content="Shiyi's blog">
<meta property="og:description">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Shiyi's blog">
<meta name="twitter:description">
<link rel="alternative" href="/atom.xml" title="Shiyi's blog" type="application/atom xml">
<link rel="icon" href="/img/favicon.png">
<link rel="stylesheet" href="/css/style.css" type="text/css">
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?a5aa860631ae09613dec7ff4fce4a6d0";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</head>
<body>
<div id="container">
<div class="left-col">
<div class="overlay"></div>
<div class="intrude-less">
<header id="header" class="inner">
<a href="/" class="profilepic">
<img lazy-src="/img/pcq.jpg" class="js-avatar">
</a>
<hgroup>
<h1 class="header-author"><a href="/">Shiyi</a></h1>
</hgroup>
<p class="header-subtitle">More simple, more effective.</p>
<div class="switch-btn">
<div class="icon">
<div class="icon-ctn">
<div class="icon-wrap icon-house" data-idx="0">
<div class="birdhouse"></div>
<div class="birdhouse_holes"></div>
</div>
<div class="icon-wrap icon-ribbon hide" data-idx="1">
<div class="ribbon"></div>
</div>
</div>
</div>
<div class="tips-box hide">
<div class="tips-arrow"></div>
<ul class="tips-inner">
<li>菜单</li>
<li>标签</li>
</ul>
</div>
</div>
<div class="switch-area">
<div class="switch-wrap">
<section class="switch-part switch-part1">
<nav class="header-menu">
<ul>
<li><a href="/">主页</a></li>
<li><a href="/archives">所有文章</a></li>
</ul>
</nav>
<nav class="header-nav">
<div class="social">
<a class="github" target="_blank" href="http://github.com/zhoushiyi" title="github">github</a>
<a class="rss" target="_blank" href="/atom.xml" title="rss">rss</a>
</div>
</nav>
</section>
<section class="switch-part switch-part2">
<div class="widget tagcloud" id="js-tagcloud">
<a href="/tags/C-C/" style="font-size: 10px;">C/C </a> <a href="/tags/数据结构/" style="font-size: 10px;">数据结构</a> <a href="/tags/算法/" style="font-size: 10px;">算法</a>
</div>
</section>
</div>
</div>
</header>
</div>
</div>
<div class="mid-col">
<nav id="mobile-nav">
<div class="overlay">
<div class="slider-trigger"></div>
<h1 class="header-author js-mobile-header hide">Shiyi</h1>
</div>
<div class="intrude-less">
<header id="header" class="inner">
<div class="profilepic">
<img lazy-src="/img/pcq.jpg" class="js-avatar">
</div>
<hgroup>
<h1 class="header-author">Shiyi</h1>
</hgroup>
<p class="header-subtitle">More simple, more effective.</p>
<nav class="header-menu">
<ul>
<li><a href="/">主页</a></li>
<li><a href="/archives">所有文章</a></li>
<div class="clearfix"></div>
</ul>
</nav>
<nav class="header-nav">
<div class="social">
<a class="github" target="_blank" href="http://github.com/zhoushiyi" title="github">github</a>
<a class="rss" target="_blank" href="/atom.xml" title="rss">rss</a>
</div>
</nav>
</header>
</div>
</nav>
<div class="body-wrap">
<article id="post-Understanding-pointer" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2015/10/03/Understanding-pointer/" class="article-date">
<time datetime="2015-10-03T02:50:10.000Z" itemprop="datePublished">2015-10-03</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2015/10/03/Understanding-pointer/">理解指针</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>在讲指针之前,先简单了解一些预备知识。</p>
<ul>
<li><strong>字节</strong>(byte)是<strong>最基本</strong>的存储单位,而<strong>位</strong>(bit)是<strong>最小</strong>的存储单位,1byte = 8bit。那么一个字节可以存储无符号值 0-255 或者有符号值 -128至127。</li>
<li>为了存储更大的值,我们把两个或更多的字节合在一起作为一个更大的存储单位:<strong>字</strong>。<br>一个字包含的位数就叫做<strong>字长</strong>。字长是CPU的主要技术指标之一,指的是CPU一次能并行处理的二进制位数。PC机所谓的16位、32位、64位指的就是字长。很显然,假设指令数目相同的情况下,字长越长,CPU单位时间能处理的数据或指令就越多,速度也就越快。</li>
<li>计算机的内存被组织成一个由<strong>N个连续的字节大小</strong>的单元组成的数组。每个字节都有一个唯一的<strong>地址</strong>。第一个字节的地址为0,接下来的字节地址为1,依此类推。(<em>为简化讨论,这里不引入物理地址和虚拟地址等概念</em>)<br>这是一个线性的<strong>地址空间</strong>:<br>{ 0, 1, 2, ……, N },N = 2^n。<br>对于32位系统,地址总线的宽度是32位,这个位数决定了地址空间的范围:<strong>[0~2^32)</strong>,所以内存大小最大为<strong>2^32byte = 4G</strong>。</li>
<li>就像一个门牌号对应一个房间一样,要访问一个内存单元就得知道它的地址。对于程序员来说,要记住地址是比较困难的,如果给地址取个名字的话则方便多了。这些名字就是高级语言中所称的<strong>变量</strong>。变量是由高级语言的编译器为我们实现的,变量给了我们一种更方便的方法来访问内存单元,程序员不必明确的知道编译器将变量放在内存中的什么位置,我们通常只关心变量的值(也就是内存单元中所存储的数据)</li>
<li>数据类型,在C语言中数据类型有整型、浮点型、指针和聚合类型(数组和结构体等)。变量用来存储数据,所以变量也同样分为这几种类型,变量的大小由类型决定。</li>
</ul>
<p>下面进入正题:</p>
<blockquote>
<p>指针</p>
</blockquote>
<p>指针是变量。指针变量的值是地址。<br>前面有提到32位系统的地址最大为2^32,所以至少要有4个字节即2^32位的二进制数才能表示的了。所以指针变量的大小为4个字节。(与字长相等)<br>任何一个变量都有地址,通过<strong>操作符&</strong>可以获取到变量的地址。<br>如果指针p的值是<strong>变量a的地址</strong>,我们称 <strong>p指向a</strong>。<br>通过<strong>操作符*</strong>可以<strong>解引用指针</strong>,即得到指针所指向的内存单元的值。<br>因为指针也是变量,所以它也有地址,如果将一个指针的地址保存到另一个指针变量中,那么就产生了一个<strong>二级指针</strong>(指向指针的指针)。<br><figure class="highlight c "><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">int</span> a = <span class="number">112</span>;</span><br><span class="line"><span class="keyword">int</span> *pa = &a; <span class="comment">//指针pa的值为变量a的地址,pa指向a</span></span><br><span class="line"><span class="keyword">int</span> **ppa = &pa; <span class="comment">//ppa是一个二级指针,ppa指向pa</span></span><br><span class="line"><span class="keyword">int</span> b = *pa; <span class="comment">//*pa的值就是a的值112</span></span><br><span class="line"><span class="keyword">int</span> c = **ppa; <span class="comment">//因为是二级指针,如果要获取a的值,要解引用两次</span></span><br><span class="line"><span class="keyword">int</span> *pa2 = *ppa; <span class="comment">//*ppa的值为指针变量pa的值,即变量a的地址</span></span><br></pre></td></tr></table></figure></p>
<p>如果指针的类型与它所指向的变量的类型不同,会怎么样呢?例如:<br><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//假设为32位系统,小端存储</span></span><br><span class="line"><span class="keyword">int</span> a= <span class="number">0x00011000</span>; <span class="comment">//a=2^16 2^12=69632</span></span><br><span class="line"><span class="keyword">int</span> *pa1 = &a;</span><br><span class="line"><span class="keyword">short</span> *pa2 = pa1; </span><br><span class="line"><span class="keyword">int</span> b = *pa2; <span class="comment">//b=2^12=4096</span></span><br><span class="line"><span class="keyword">void</span> *p = pa2;</span><br><span class="line"><span class="keyword">int</span> c = *p; <span class="comment">//error!</span></span><br></pre></td></tr></table></figure></p>
<p>可见,解引用得到的结果依赖于指针的类型。也就是说,指针的类型决定了解引用将会从内存中取出多少个连续的字节。我们知道short一般占2个字节,而int占4个字节,所以即使指针pa1和pa2的值都是整型变量a的地址(a占4个字节,这里的地址是4个字节中第1个字节的地址),但是对两者解引用所得到的值却是不同的,因为pa2的类型是short*,对其解引用将只得到变量a前2个字节所表示的数值(4096)。</p>
<p>我们必须明白不管指针本身的类型是什么,指针变量的值始终是一个地址,而地址就是一个整数。那么指针到底要声明成什么类型则完全取决于程序员想怎么使用这个指针。<br>甚至可以将指针声明为void*类型,它可以存储任何变量的地址。但是如果你对一个void*类型的指针解引用,编译器将报错,因为void*代表没有类型,编译器将不知道要从该指针所指向的地址位置取出多少个字节。</p>
<blockquote>
<p>指针的声明</p>
</blockquote>
<p>前面举的例子中,指针的声明都比较简单,很容易看出指针所指向的数据类型。下面看一些更复杂的声明:<br><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">int</span> *f(<span class="keyword">void</span>); <span class="comment">//f是一个函数,它的返回值类型为int*(指向整型的指针)</span></span><br><span class="line"><span class="keyword">int</span> (*f)(<span class="keyword">void</span>); <span class="comment">//f是一个函数指针,它指向的函数的返回值为int</span></span><br><span class="line"><span class="keyword">int</span> *(*f)(<span class="keyword">void</span>); <span class="comment">//f也是函数指针,它指向的函数的返回值为int*</span></span><br><span class="line"><span class="keyword">int</span> *f[]; <span class="comment">//f是一个数组,它的元素类型是int*</span></span><br><span class="line"><span class="keyword">int</span> (*f[])(<span class="keyword">void</span>); <span class="comment">//f是一个数组,它的元素类型是函数指针,这个函数指针所指向的函数的返回值是int</span></span><br><span class="line"><span class="keyword">int</span> *(*f[])(<span class="keyword">void</span>); <span class="comment">//f是一个数组,它的元素类型是函数指针,这个函数指针所指向的函数的返回值是int*</span></span><br></pre></td></tr></table></figure></p>
<p>正确识别上面的声明的诀窍在于,找到所有的操作符,然后按正确的次序执行它们,比如第5行的声明中,第1个括号的表达式*f[]首先进行求值,[]的优先级高于*,f先与[]结合,所以f是一个数组,然后是*,所以f是一个元素为某种类型的指针的数组。<br>第2个括号()是函数调用操作符,所以f数组的元素的类型是指向函数的指针,它指向的函数的返回值是int(整型)。</p>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/C-C/">C/C </a></li></ul>
</div>
<p class="article-more-link">
<a href="/2015/10/03/Understanding-pointer/#more">more >></a>
</p>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-ADT" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2015/09/28/ADT/" class="article-date">
<time datetime="2015-09-27T17:37:47.000Z" itemprop="datePublished">2015-09-28</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2015/09/28/ADT/">表、栈和队列(一)</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="表_ADT">表 ADT</h1><p> 一般的形如A1,A2,A3,…,AN的表。表的大小为N。大小为0的表为空表。<br> 对表的所有操作都可以通过使用<strong>数组</strong>来实现。<br> 数组的存储是<strong>连续</strong>的,可以用下标对数组进行随机访问,只需要花费常数时间。然而遍历和Find都将以线性时间执行,而且插入和删除的花费昂贵,插入/删除一个元素都需要将位置后/前所有的元素移动一个位置,因此仍然需要线性时间。<br> 因为插入和删除的运行时间如此慢以及表的大小还必须事先已知,所以简单数组一般不用来实现表这种结构。</p>
<ul>
<li><h1 id="链表">链表</h1></li>
</ul>
<p> 为了避免插入和删除的线性开销,需要允许表可以不连续存储,否则表的部分或者全部需要整体移动。<br> 链表由一系列不必在内存中相连的结构(节点)组成。每一个节点均含有表元素和指向后继元节点的指针。最后一个节点的该指针指向NULL。<br> <img src="/img/list.png" alt="链表1"></p>
<p> 使用一个根指针(head)来代表链表的起始位置,根指针只是一个指针,它不包含任何数据。<em>注意:这里没有使用头节点(哑节点)</em></p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//单链表</span></span><br><span class="line"><span class="preprocessor">#ifndef _MYLIST_H_</span></span><br><span class="line"><span class="preprocessor">#<span class="keyword">define</span> _MYLIST_H_</span></span><br><span class="line"></span><br><span class="line"><span class="preprocessor">#<span class="keyword">include</span> <stdio.h></span></span><br><span class="line"><span class="preprocessor">#<span class="keyword">include</span> <stdlib.h></span></span><br><span class="line"><span class="preprocessor">#<span class="keyword">include</span> <assert.h></span></span><br><span class="line"></span><br><span class="line"><span class="keyword">struct</span> Node;</span><br><span class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span> Node *PtrToNode;</span><br><span class="line"><span class="keyword">typedef</span> PtrToNode List;</span><br><span class="line"><span class="keyword">typedef</span> PtrToNode Position;</span><br><span class="line"><span class="keyword">typedef</span> <span class="keyword">int</span> ElementType;</span><br><span class="line"></span><br><span class="line"><span class="keyword">struct</span> Node</span><br><span class="line">{</span><br><span class="line"> ElementType element;</span><br><span class="line"> PtrToNode next;</span><br><span class="line">};</span><br><span class="line"></span><br><span class="line"><span class="preprocessor">#<span class="keyword">define</span> FALSE 0</span></span><br><span class="line"><span class="preprocessor">#<span class="keyword">define</span> TRUE 1</span></span><br><span class="line"></span><br><span class="line"><span class="function">List <span class="title">Append</span><span class="params">(List l, ElementType x)</span></span>; </span><br><span class="line"><span class="function">List <span class="title">Create</span><span class="params">(ElementType *a, <span class="keyword">int</span> size)</span></span>; </span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">Insert</span><span class="params">(PtrToNode *linkp, ElementType x)</span></span>; </span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">InsertAtP</span><span class="params">(PtrToNode *linkp, Position p, ElementType x)</span></span>; </span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">Delete</span><span class="params">(PtrToNode *linkp, Position p)</span></span>; </span><br><span class="line"><span class="function">Position <span class="title">Find</span><span class="params">(List l, ElementType x)</span></span>; </span><br><span class="line"><span class="function">List <span class="title">Reverse</span><span class="params">(List l)</span></span>; </span><br><span class="line"><span class="function">List <span class="title">ReverseRecursive</span><span class="params">(List l)</span></span>; </span><br><span class="line"></span><br><span class="line"><span class="preprocessor">#<span class="keyword">endif</span> <span class="comment">//"mylist.h"</span></span></span><br></pre></td></tr></table></figure>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="preprocessor">#<span class="keyword">include</span> "mylist.h"</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//建立链表</span></span><br><span class="line"><span class="function">List <span class="title">Create</span><span class="params">(ElementType *a, <span class="keyword">int</span> size)</span></span><br><span class="line"></span>{</span><br><span class="line"> <span class="keyword">int</span> i;</span><br><span class="line"> List head = NULL;</span><br><span class="line"> <span class="keyword">for</span>(i = <span class="number">0</span>; i < size; i ) {</span><br><span class="line"> head = Append(head, a[i]);</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> head;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">//尾插法</span></span><br><span class="line"><span class="function">List <span class="title">Append</span><span class="params">(List l, ElementType x)</span></span><br><span class="line"></span>{</span><br><span class="line"> List p = l;</span><br><span class="line"> PtrToNode newNode = NULL;</span><br><span class="line"> newNode = (PtrToNode)<span class="built_in">malloc</span>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> Node));</span><br><span class="line"> <span class="keyword">if</span> (newNode) {</span><br><span class="line"> newNode->element = x;</span><br><span class="line"> newNode->next = NULL;</span><br><span class="line"> <span class="keyword">if</span> (p) {</span><br><span class="line"> <span class="keyword">while</span>(p->next) {</span><br><span class="line"> p = p->next;</span><br><span class="line"> }</span><br><span class="line"> p->next = newNode;</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> l = newNode;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> l;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/数据结构/">数据结构</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/算法/">算法</a></li></ul>
</div>
<p class="article-more-link">
<a href="/2015/09/28/ADT/#more">more >></a>
</p>
<div class="clearfix"></div>
</div>
</div>
</article>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info">
<div class="footer-left">
© 2015 Shiyi
</div>
<div class="footer-right">
<a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
</div>
</div>
</div>
</footer>
</div>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
<script>
var yiliaConfig = {
fancybox: true,
mathjax: true,
animate: true,
isHome: true,
isPost: false,
isArchive: false,
isTag: false,
isCategory: false,
open_in_new: false
}
</script>
<script src="http://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="/js/main.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i = 1) {
all[i].SourceElement().parentNode.className = ' has-jax';
}
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</div>
</body>
</html>