Computer Systems and Applications
Number Systems 进制 基数 前缀 数值表示 decimal 10 26 binary 2 0b 0b11010 octal 8 0 032 hexadecimal 16 0x 0x1A Convert decimal to binary integer: 除2取余数,从下到上 fraction: 小数部分乘2取整数,从上到下 多算一位,如果是1就进位 complement(二进制正负数转换)signed/unsigned numbers Unsigned numbers:只有正数和0 Signed numbers:包括正数和负数 Sign-and-Magnitudenegative: invert the sign 0 for positive, 1 for negative -> 0 100 1100 (8 bits) 0 for sign/7 for magnitude largest number: 0111 1111=+127 smallest number:...
sql(postgresql)
Application LayerState Level Interface(SLI)sql statement+hose language: python, java, go, c/c++ python+PostgreSQLpsycopg in terminal/cmd: 12python3 -m pip install psycopgpip install "psycopg[binary]" codein pgAdmin4 1234# open permission to userGRANT ALL ON ALL TABLES IN SCHEMA public TO testuser# close permission to userREVOKE ALL ON ALL TABLES IN SCHEMA public FROM testuser; in idel shell 123456789import psycopgconnection=psycopg.connect("dbname='Le Tour...
Python Fundamental
File IOwrite a file 123with open('my_file.txt','w') as f: f.write('This is my first line'+'\n') f.write('This is my second line'+'\n') file opening modes Modes Description r open a file for reading only, pointer at beginning w open a file for writing only.if exist, overwriteif not exist, create a new file for writing a open a file for appendingif exist, pointer at the endif not exist, create a new file _b in binary...
代码随想录笔记
数组二分查找 (704. 二分查找) 时间复杂度: 暴力解法时间复杂度:O(n) 二分法时间复杂度:O(logn) 对于有序数组,使用middle,left,right来解题 二分查找两种写法,按不同区间来区分 target -> [left,right] target -> [left,right) 注意事项: 定义right:1. len(nums)-1 2.len(nums) 1的left=right有意义,所以写循环的时候要注意边界 while(left<=right),同理2的循环是小于号 切换指针时候: left=middle+1 / right=middle-1 12345678910111213class Solution: def search(self, nums: List[int], target: int) -> int: left=0 right=len(nums)-1 while...
Leetcode Journey
题号 难度 时间 方法 注意事项 备注 数组 1 704. Binary Search 704 Easy 2024-10-11 二分查找 注意边界left/right/middle 2 27. Remove Element 27 Easy 2024-10-11 双指针法 快慢指针slow/fast 3 977. Squares of a Sorted Array 977 Easy 2024-10-11 双指针法 画图比较容易理解 4 209. Minimum Size Subarray Sum 209 Medium 2024-10-11 双指针法 滑动窗口(subarray) 5 59. Sprial Matrix 59 Medium 2024-10-14 模拟行为 从上到下,从左到右,左闭右开区间 有点复杂 6 区间和 2024-10-14 区间和 p[i]表示 下标 0 到 i 的 vec[i] 累加...
How to Use Hexo
It’s a good trial to build my first blog using hexo and github! I believe this is a huge step in my programming trip. I will use this blog to record my studying process in computer science/languages, maybe sometime I will share some life. Tips to use hexo my blog address: https://brittanywu.github.io/ open terminal in MacOS: 1. command+space 2. enter ‘terminal’ blog stored in “source/_posts” tags should be written as tags:[Tag1, Tag2,Tag3] categories: - [Cat1]//-...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment