面试笔记
http://www.iocoder.cn/ : 芋道源码
https://notebook.js.org/#/README
https://github.com/hadyang/interview
https://hadyang.github.io/interview/docs/basic/algo/tree/
String:字符串常量池: https://segmentfault.com/a/1190000009888357
Springg boot Demo : https://github.com/xkcoding/spring-boot-demo
推荐网址:
https://python3-cookbook.readthedocs.io/ 五颗星
https://www.liaoxuefeng.com/wiki/1016959663602400 廖雪峰
python-面试通关宝典:https://www.cnblogs.com/duanming/p/11830267.html
PEP8 Python 编码规范整理:http://blog.sae.sina.com.cn/archives/4781
https://www.javanav.com/interview/b5d9e1d5736642f78ffd528d14070617.html
安全
跨站脚本漏洞(XSS)基础讲解:https://www.jianshu.com/p/4fcb4b411a66
https://blog.csdn.net/qq_41637554/article/details/80844386
算法
数值交换
a = 2 b = 3 # 方法一 a,b = b,a # 方法二 tmp = a a = b b = tmp # 方法三 a = a+b b = a - b a = a - b # 方法四 a = a^b # a = 10 ^ 11 = 01 = 1 b = a^b # b = 01 ^ 11 = 10 = 2 a = a^b # a = 01 ^ 10 = 11 = 3
经典排序算法:https://zhuanlan.zhihu.com/p/37430943
堆排序:
https://www.jianshu.com/p/0d383d294a80
https://www.jianshu.com/p/d174f1862601
class HeapSort(object): def build_max_heap(self, array): for i in range(len(array) // 2 - 1, -1, -1): self.heap_adjust(array, i, len(array)) def heap_adjust(self, array, index, array_len): left = 2 * index + 1 right = 2 * index + 2 largest = index if left < array_len and array[left] > array[largest]: largest = left if right < array_len and array[right] > array[largest]: largest = right if largest != index: array[largest], array[index] = array[index], array[largest] self.heap_adjust(array, largest, array_len) def heap_sort(self, array): self.build_max_heap(array) for i in range(len(array) - 1, -1, -1): array[0], array[i] = array[i], array[0] self.heap_adjust(array, 0, i) if __name__ == "__main__": array = [50, 16, 30, 10, 60, 90, 2, 80, 70] heap_sort = HeapSort() heap_sort.heap_sort(array) print(array)
快排:
# 方法一 def quick_sort(arr): if len(arr) < 2: return arr pivot = arr[0] less = [x for x in arr[1:] if x <= pivot] more = [x for x in arr[1:] if x > pivot] return quick_sort(less) + [pivot] + quick_sort(more) # 方法二 class QuickSort(object): def quick_sort(self, arr, low, high): if low < high: i = self.partition(arr, low, high) self.quick_sort(arr, low, i - 1) self.quick_sort(arr, i + 1, high) def swap(self, arr, i, j): arr[i], arr[j] = arr[j], arr[i] def partition(self, arr, low, high): pivot = arr[low] index = low while low < high: while low < high and arr[high] >= pivot: high -= 1 while low < high and arr[low] <= pivot: low += 1 self.swap(arr, low, high) self.swap(arr, index, low) return low 方法三: def quick_sort(arr, low, high): if low < high: i = partition(arr, low, high) quick_sort(arr, low, i - 1) quick_sort(arr, i + 1, high) def partition(arr, low, high): pivot = low while low < high: while low < high and arr[high] >= arr[pivot]: high -= 1 while low < high and arr[low] <= arr[pivot]: low += 1 arr[low], arr[high] = arr[high], arr[low] arr[pivot], arr[low] = arr[low], arr[pivot] return low test_arr = [9, 1, 5, 2, 98, 23] quick_sort(test_arr, 0, len(test_arr) - 1) print(test_arr)
开发模式
单例模式
https://zhuanlan.zhihu.com/p/37534850
https://www.cnblogs.com/huchong/p/8244279.html
线程安全的单例:
https://blog.csdn.net/chichu261/article/details/84347305
https://www.jianshu.com/p/6a1690f0dd00
import threading """ 线程安全的单利模式 紧跟with后面的语句被求值后,返回对象的 __enter__() 方法被调用,这个方法的返回值将被赋值给as后面的变量。 当with后面的代码块全部被执行完之后,将调用前面返回对象的 __exit__()方法 """ def synchronized(func): func.__lock__ = threading.Lock() def lock_func(*args, **kwargs): with func.__lock__: return func(*args, **kwargs) return lock_func class Singleton(object): instance = None @synchronized def __new__(cls): # 关键在于这,每一次实例化的时候,我们都只会返回这同一个instance对象 if not cls.instance: cls.instance = super(Singleton, cls).__new__(cls) return cls.instance
import threading class Singleton(object): _instance_lock = threading.Lock() def __init__(self, *args, **kwargs): pass def __new__(cls, *args, **kwargs): if not hasattr(cls, '_instance'): with Singleton._instance_lock: if not hasattr(cls, '_instance'): Singleton._instance = super().__new__(cls) return Singleton._instance obj1 = Singleton() obj2 = Singleton() print(obj1, obj2) def task(arg): obj = Singleton() print(obj) for i in range(10): t = threading.Thread(target=task, args=[i, ]) t.start()
import threading import time class SingletonSafe(object): """线程不安全单例模式""" lock = threading.Lock() def __new__(cls, *args, **kwargs): if not hasattr(SingletonSafe, '_instance'): with SingletonSafe.lock: if not hasattr(SingletonSafe, "_instance"): time.sleep(2) SingletonSafe._instance = super(SingletonSafe, cls).__new__(cls) return SingletonSafe._instance class SingletonUnsafe(object): """线程安全单例模式""" def __new__(cls, *args, **kwargs): if not hasattr(SingletonUnsafe, '_instance'): time.sleep(2) SingletonUnsafe._instance = super(SingletonUnsafe, cls).__new__(cls) return SingletonUnsafe._instance def test_singleton(clz): def task(arg): obj = clz(arg) print(obj) for i in range(10): t = threading.Thread(target=task, args=[i, ]) t.start() if __name__ == "__main__": test_singleton(SingletonUnsafe) test_singleton(SingletonSafe)
Python基础
赋值、浅拷贝和深拷贝:https://zhuanlan.zhihu.com/p/54011712
iter函数解释
菜鸟教程: https://www.runoob.com/python/python-func-iter.html
class Counter: def __init__(self, _start, _end): self.start = _start self.end = _end def get_next(self): s = self.start if self.start < self.end: self.start += 1 else: raise StopIteration return s c = Counter(1, 5) iterator = iter(c.get_next, 4) print(type(iterator)) for i in iterator: print(i)
属性描述符:
https://blog.csdn.net/qq_34979346/article/details/83758447
https://blog.csdn.net/qq_37482956/article/details/100060995
Python 高级
lambda表达式:https://www.jianshu.com/p/ab9890771cd5
魔法方法
简述 Python 类中的 __init__、__new__、__call__ 方法:https://zhuanlan.zhihu.com/p/27830675
Python中获取属性:getattr、__get__、__getattr__和__getattribute__: https://blog.csdn.net/zhangmoyan9527/article/details/82751658
Python魔法方法:https://www.jianshu.com/p/3f4786b33f34
Python super() 函数: https://zhuanlan.zhihu.com/p/28340924
垃圾回收机制
Python 中的垃圾回收机制:https://zhuanlan.zhihu.com/p/62282961
主流的垃圾回收机制都有哪些:https://www.zhihu.com/question/32373436/answer/549698608
monkey patch(猴子补丁):https://zhuanlan.zhihu.com/p/71181926
Python 常见的 170 道面试题全解析:2019 版:https://gitchat.csdn.net/activity/5cf8ca61da0c2c41ee4697ff?utm_source=blog0715#85
Python super()方法、多继承以及MRO顺序:https://www.jianshu.com/p/3b7ebe0389e4
如何判断一个对象是函数还是方法?:https://blog.csdn.net/Da___Vinci/article/details/95599731
@staticmethod和@classmethod:https://zhuanlan.zhihu.com/p/69717906
python中的接口:https://blog.csdn.net/kobeyan/article/details/44344087
抽象类和接口类:https://www.cnblogs.com/weihengblog/p/8528967.html
Python中可变类型与不可变类型数据在内存中的引用:https://blog.csdn.net/lucky_q/article/details/82785725
深入python内存管理:https://zz.zzs7.top/python-memory-management.html
生成器:https://blog.csdn.net/weixin_42223833/article/details/86529164
对python中数组的del,remove,pop区别详解:https://www.jb51.net/article/150355.htm
如何把元组 ("a","b") 和元组 (1,2),变为字典 {"a":1,"b":2}:https://blog.csdn.net/qq_21101587/article/details/96289391
在Python中,字典按值排序:https://blog.csdn.net/weixin_30537391/article/details/95878324
Python 变量作用域:
https://www.jianshu.com/p/3bb277c2935c
https://www.runoob.com/python3/python3-namespace-scope.html
python set 交集、并集、差集:https://blog.csdn.net/Chihwei_Hsu/article/details/81416818
如何优化Python占用的内存:
https://zhuanlan.zhihu.com/p/70015674
https://juejin.im/entry/5d37cc45e51d454f723025d9
面向对象
面向对象的三大基本特征,五大基本原则:https://www.cnblogs.com/fzz9/p/8973315.html
计算机网络
TCP的三次握手和四次挥手:https://zhuanlan.zhihu.com/p/58603455
HTTP/2 新特性总结:https://www.jianshu.com/p/67c541a421f9
HTTPS 原理详解: https://zhuanlan.zhihu.com/p/27395037
ftp和http区别: https://blog.csdn.net/only_musm/article/details/78983364
操作系统
僵尸进程和孤儿进程:https://zhuanlan.zhihu.com/p/96098130
硬链接和软链接:https://www.jianshu.com/p/dde6a01c4094
TCP连接:https://www.jianshu.com/p/ef892323e68f 三次握手、四次挥手、syn攻击和wait_time(2MSL)
drop,truncate,delete 三者的区别: https://blog.csdn.net/GRAY_KEY/article/details/86742248
redis
redis的事务和watch:
https://www.jianshu.com/p/361cb9cd13d5
https://www.redis.net.cn/tutorial
关于Redis处理高并发:https://www.cnblogs.com/wanlei/p/10464517.html
https://naotu.baidu.com/file/b49ccc722da46972dfe3a720cd414a11
工作经历:https://www.jianliben.com/article/detail/30325
程序员简历应该怎么写?:https://www.zhihu.com/question/25002833
如何做一份优秀的简历?:https://www.zhihu.com/question/19766230
优秀简历要遵循哪些规则?:https://www.zhihu.com/question/20184884

浙公网安备 33010602011771号