1
1
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again -->
2
2
** Table of Contents**
3
3
4
- - [ Python面试题集] ( #python )
5
4
- [ Python语言特性] ( #python )
6
5
- [ 1 Python的函数参数传递] ( #1-python )
7
6
- [ 2 Python中的元类(metaclass)] ( #2-pythonmetaclass )
98
97
- [ 3 fromkeys()方法] ( #3-fromkeys )
99
98
- [ 8 合并两个有序列表] ( #8- )
100
99
- [ 9 交叉链表求交点] ( #9- )
101
- - [ Definition for singly-linked list.] ( #definition-for-singly-linked-list )
102
- - [ class ListNode:] ( #class-listnode )
103
- - [ def __ init__ (self, x):] ( #def-initself-x )
104
- - [ self.val = x] ( #selfval--x )
105
- - [ self.next = None] ( #selfnext--none )
106
100
- [ 10 二分查找] ( #10- )
107
101
- [ 11 快排] ( #11- )
108
102
- [ 12 找零问题] ( #12- )
109
103
- [ 13 广度遍历和深度遍历二叉树] ( #13- )
110
- - [ 14 二叉树节点] ( #14- )
111
- - [ 15 层次遍历] ( #15- )
112
- - [ 16 深度遍历] ( #16- )
104
+ - [ 14 二叉树节点] ( #14- )
105
+ - [ 15 层次遍历] ( #15- )
106
+ - [ 16 深度遍历] ( #16- )
113
107
- [ 17 前中后序遍历] ( #17- )
114
108
- [ 18 求最大树深] ( #18- )
115
109
- [ 19 求两棵树是否相同] ( #19- )
116
110
- [ 20 前序中序求后序] ( #20- )
117
- - [ 重建] ( # )
118
- - [ 后序遍历] ( # )
119
111
- [ 21 单链表逆置] ( #21- )
120
112
121
113
<!-- markdown-toc end -->
122
114
123
- # Python面试题集
124
-
125
- 目前面了4家python的公司,基本都是很基础的东西,对比发现和stackoverflow上高票数的问题有很多重复,整理一下希望对别人有帮助.
126
-
127
- 其中有可能是自己想到的一些知识点,也有一些是网上收集的.答案可能不太详尽,有需要还是自己搜一下吧.
128
-
129
115
# Python语言特性
130
116
131
117
## 1 Python的函数参数传递
@@ -905,7 +891,7 @@ Socket=Ip address+ TCP/UDP + port
905
891
3 . 文件断点续传
906
892
3 . 身份认证,状态管理,Cache缓存
907
893
908
- ## Ajax
894
+ ## 21 Ajax
909
895
910
896
# * NIX
911
897
@@ -1124,11 +1110,10 @@ def loop_merge_sort(l1, l2):
1124
1110
去哪儿的面试,没做出来.
1125
1111
1126
1112
``` python
1127
- # Definition for singly-linked list.
1128
- # class ListNode:
1129
- # def __init__(self, x):
1130
- # self.val = x
1131
- # self.next = None
1113
+ class ListNode :
1114
+ def __init__ (self , x ):
1115
+ self .val = x
1116
+ self .next = None
1132
1117
def node (l1 , l2 ):
1133
1118
length1, lenth2 = 0 , 0
1134
1119
# 求两个链表长度
@@ -1223,7 +1208,7 @@ if __name__ == '__main__':
1223
1208
给定一个数组,构建二叉树,并且按层次打印这个二叉树
1224
1209
1225
1210
``` python
1226
- # 14 二叉树节点
1211
+ # # 14 二叉树节点
1227
1212
class Node (object ):
1228
1213
def __init__ (self , data , left = None , right = None ):
1229
1214
self .data = data
@@ -1232,7 +1217,7 @@ class Node(object):
1232
1217
1233
1218
tree = Node(1 , Node(3 , Node(7 , Node(0 )), Node(6 )), Node(2 , Node(5 ), Node(4 )))
1234
1219
1235
- # 15 层次遍历
1220
+ # # 15 层次遍历
1236
1221
def lookup (root ):
1237
1222
stack = [root]
1238
1223
while stack:
@@ -1242,7 +1227,7 @@ def lookup(root):
1242
1227
stack.append(current.left)
1243
1228
if current.right:
1244
1229
stack.append(current.right)
1245
- # 16 深度遍历
1230
+ # # 16 深度遍历
1246
1231
def deep (root ):
1247
1232
if not root:
1248
1233
return
@@ -1285,7 +1270,6 @@ def isSameTree(p, q):
1285
1270
推荐: http://blog.csdn.net/hinyunsin/article/details/6315502
1286
1271
1287
1272
``` python
1288
- # 重建
1289
1273
def rebuild (pre , center ):
1290
1274
if not pre:
1291
1275
return
@@ -1295,7 +1279,6 @@ def rebuild(pre, center):
1295
1279
cur.right = rebuild(pre[index + 1 :], center[index + 1 :])
1296
1280
return cur
1297
1281
1298
- # 后序遍历
1299
1282
def deep (root ):
1300
1283
if not root:
1301
1284
return
0 commit comments