
programming
文章平均质量分 62
OString2024
个人公众号:OString2024
zhihu:Ostring
展开
-
计算机科学史
经典电磁学Benjamin Franklin(1706~1790)The discovery of Electron(1897)Bohr model of HydrMatter waves are problebility waveHistory of electronic devicethe invertor of Mosfetthe first IC原创 2022-01-16 12:04:18 · 535 阅读 · 0 评论 -
计算机系统中的并行
指令级并行( instruction level parallelism (ILP))instruction pipelinesuperscalarout of orderspeculative executionbranch prediction原创 2020-04-12 22:55:22 · 500 阅读 · 0 评论 -
程序优化方法讨论
cache 是利用计算机系统中的局部性原理进行程序加速的一种系统设计方式。其中结合了空间局部性和时间局部性的处理。cache的组织方式Direct-mapped caches perform poorly relative to set associative caches when multiple memory references conflict with each other....原创 2020-04-12 22:53:43 · 522 阅读 · 0 评论 -
python 底层实现原理
//object base classtypedef struct _object { PyObject_HEAD} PyObject;//variable length object base classtypedef struct { PyObject_VAR_HEAD} PyVarObject;PyObject_VAR_HEAD中int ob_refcnt[objec...原创 2019-11-18 11:49:21 · 1933 阅读 · 1 评论 -
Leetcode Binary Tree recursive and iterative summary
[572] Subtree of Another Treeclass Solution(object): def isSubtree(self, s, t): """ :type s: TreeNode :type t: TreeNode :rtype: bool """ if not s ...原创 2019-07-12 11:49:45 · 147 阅读 · 0 评论 -
Leetcode Summary: Graph
743. Network Delay TimeInput: times = [[2,1,1],[2,3,1],[3,4,1]], N = 4, K = 2Output: 2class Solution(object): def networkDelayTime(self, times, N, K): """ :type times: List[Lis...原创 2019-07-05 11:49:17 · 212 阅读 · 0 评论 -
Leetcode Summary: Ugly number
[264] Ugly Number IIclass Solution(object): def nthUglyNumber(self, n): """ :type n: int :rtype: int """ if n<=0: return 0 if n==1:...原创 2019-07-04 11:50:09 · 100 阅读 · 0 评论 -
Leetcode summary: Monostone Stack problem
42. Trapping Rain Waterclass Solution(object): def trap(self, height): """ :type height: List[int] :rtype: int """ st=[] #use decrease stack here ...原创 2019-07-04 09:42:54 · 229 阅读 · 0 评论 -
Leetcode [740]. Delete and Earn & [213]. House Robber II
Take or Skip problem740. Delete and Earnclass Solution(object): def deleteAndEarn(self, nums): """ :type nums: List[int] :rtype: int """ dp=[0 for i in ra...原创 2019-06-28 16:35:10 · 105 阅读 · 0 评论 -
Leetcode summary: dynamic programing, [322] coin change & [474] ones and zeros
[322] coin changeclass Solution(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ #init as...原创 2019-06-26 14:38:18 · 127 阅读 · 0 评论 -
Leetcode[692] and[347] Heapq problem
本质上是一样的解决方案,利用python的heapq 进行解题[347] Top K Frequent Elementsclass Solution(object): def topKFrequent(self, nums, k): """ :type nums: List[int] :type k: int :rtype...原创 2019-06-12 18:09:11 · 280 阅读 · 0 评论 -
Leetcode summary: array number in the range of array length
这类题一般有个前提:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array)442. Find All Duplicates in an Arrayclass Solution(object): def findDuplicates(self, nums): """ :type num...原创 2019-07-24 15:03:39 · 123 阅读 · 0 评论 -
Leetcode Summary: Union Find
721. Accounts Mergeclass Solution(object): def accountsMerge(self, accounts): def find(a): if ds[a] < 0: return a ds[a] = find(ds[a]) ...原创 2019-07-30 09:49:08 · 118 阅读 · 0 评论 -
LeetCode[24] Swap Nodes in Pairs
My solution:mark: not work# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): d...原创 2019-08-08 15:33:29 · 99 阅读 · 0 评论 -
Leetcode summary: backstrack problem
permutation77. Combinationsclass Solution(object): def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ def backtra...原创 2019-08-14 20:39:54 · 144 阅读 · 0 评论 -
Leetcode[234] Palindrome Linked List
234. Palindrome Linked Listrecursion not work, stack will be overflowclass Solution(object): def isPalindrome(self, head): """ :type head: ListNode :rtype: bool "...原创 2019-08-10 23:16:28 · 106 阅读 · 0 评论 -
Leetcode [91]: Decode ways
91.Decode Waysdfs way:class Solution(object): def numDecodings(self, s): """ :type s: str :rtype: int """ out=[] self.ret=0 def h...原创 2019-08-15 20:20:13 · 125 阅读 · 0 评论 -
Leetcode summary: some trick problem
781. Rabbit in the forrest## @lc app=leetcode id=781 lang=python## [781] Rabbits in Forest#class Solution(object): def numRabbits(self, answers): """ :type answers: List[int]...原创 2019-08-13 09:35:25 · 204 阅读 · 0 评论 -
leetcode summary: link list problem solved by extra space
143. Reorder Listlink list ⇒ listclass Solution(object): def reorderList(self, head): """ :type head: ListNode :rtype: None Do not return anything, modify head in-place i...原创 2019-08-13 09:36:09 · 140 阅读 · 0 评论 -
理解嵌入式系统中基本的语音算法
转至 https://www.embedded.com/print/4015932Understand the fundamentals of speech algorithms in an embedded systemNitin Jain, MindTree Consulting - February 06, 2006An enormously high number of algori...转载 2019-08-27 18:22:45 · 506 阅读 · 0 评论 -
深究ARM串口重定向问题
在使用一块stm32开发板时,取消勾选microlib 后,使用标准c 库,发现串口重定向失效,串口不再输出printf 字符串, 感觉很奇怪,这边理清下问题的原因:microlib 是经过优化过的c lib 库,通过microlib进行重定向的方法很简单:#ifdef __GNUC__ /* With GCC, small printf (option LD Linker->Lib...原创 2019-05-09 19:33:11 · 1041 阅读 · 0 评论 -
Leetcode[2] Add Two Numbers and Leetcode[445] Add Two Numbers II
Leetcode[2] Add Two Numbersclass Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ ...原创 2019-04-30 17:16:05 · 196 阅读 · 0 评论 -
Linux 内核设计与实现(linux kernel design and realization)
Author: Robert Lovecommand:ps-el :查看系统中的进程列表ps -eo state,uid, pid, ppid, rtprio, time, commkernel introductionprocessor state:user mode, process statekernel mode, process statekernel mode...原创 2018-10-05 09:04:03 · 398 阅读 · 0 评论 -
Linux Driver
设备分类字符设备块设备网络设备驱动在kernel中的位置GNU C vs ANSI CtypeofKernel moduleslsmod 读取/proc/modules 下的所有文件信息127|root@astar-evb30:/sdcard # lsmodspi_aichip 7292 0 - Live 0x00000000aispeech...原创 2018-10-05 09:03:31 · 1826 阅读 · 0 评论 -
Have a close look at FreeRTOS
FreeRTOS learning FrameworkIncluding: task、communication(queue)、hardware whisperer(port) task.c、port.c、queue.cRanging from single CPU to highly functional multicore beast with TCP/IP,filse...原创 2018-05-30 22:03:07 · 1034 阅读 · 0 评论 -
Leetcode Journey
数组按出现频次从大到小排序http://www.geeksforgeeks.org/amazon-interview-set-21/#include &amp;amp;amp;amp;amp;amp;amp;lt;stdio.h&amp;amp;amp;amp;amp;amp;amp;gt;typedef struct{int id;int count;}item;void sort(int a[], int n){item temp[n];原创 2018-05-23 10:42:14 · 221 阅读 · 0 评论 -
USB 协议Audio应用
usb作为目前最为通用的接口,为提高产品用户体验,减小产品的设计复杂度,立下了悍马功劳,但是也因其通用的特性,其相对于其他接口,协议更为复杂,同时也在不断发生演进,充实目前的协议规范,带宽有了很大的提升,同时尺寸也在不断缩小。最近因为使用usb 进行音频数据的采集,对usb 协议做了一次系统性了解,同时以usb audio class 协议作为范本,进一步了解usb 协议规范。USB ...原创 2018-05-08 10:59:07 · 16109 阅读 · 0 评论 -
Direct Memory Access(DMA)使用详解(一)
转载一篇文章,文章来源: https://letanphuc.net/2014/06/how-to-use-stm32-dma/, 比较直观的介绍了DMA的使用,同时对比了cpu和dma对内存操作的时效性。How to use STM32 DMA06 JUNE 2014 on stm32 dmaIn many microcontroller applications, you ...翻译 2018-04-14 19:31:39 · 5410 阅读 · 0 评论 -
数据结构
《大话数据结构》,一本介绍常用数据结构的工具书,在毕业找工作时,一些容易遗忘的数据结构,通常随手在这本书中找到答案,并很快回忆起书中相关的代码实现方法,在笔试时起到了不小的作用。今天,重新整理下之前的笔记。@home chapter 01首先是一些基本概念:数据:计算机操作的对象数据元素:组成数据的基本单位。 数据项:数据元素可由若干个数据项组成数据对象:性质相同的数据元素...原创 2018-03-31 23:20:01 · 366 阅读 · 0 评论 -
转载:关于编程语言未来的 12 个预测
转载一篇2014年看到的文章,现在回顾,发现很多都有应验,预测是一种很难得的能力。现在技术发展很快,会有很多分支,同时也给从业人员带来更多的焦虑,对行业,对技术的预判,可以坚定技术方向的信心,去伪存真。来源:http://www.zoneself.org/202014年03月03日 ⁄ 未分类 ⁄ 暂无评论击中目标很难,击中移动中的目标更难。正因如此,创造一项合适的新技术几乎是不可能的,因...转载 2018-09-29 09:49:37 · 1064 阅读 · 0 评论 -
libusb移植错误
error 1/configure --build=i686-linux --host=arm-linux CC=/home/hunter/jobfile/soc_platform/rk3308cc/sdk/rk3308-arm64-glibc-2018.03-toolschain/bin/aarch64-rockchip-linux-gnu-gcc --disable-udev==&g...原创 2019-01-30 09:50:22 · 899 阅读 · 0 评论 -
Lookup Table 应用
关于Lookup Table 的应用一直没有太清晰的概念,下面这篇wiki比较全面的介绍了Lookup Table 的使用,附上连接:https://en.wikipedia.org/wiki/Lookup_tableLookup tableFrom Wikipedia, the free encyclopediaJump to navigationJump to searchThis ...原创 2019-03-25 15:50:28 · 10757 阅读 · 0 评论 -
ASIP design flow
using nML description language, it can generate the core processor instruction, and it will used as input to whole sdkusing sdk, the target algorithm written with c language can compile and linked t...原创 2019-05-06 10:51:58 · 1239 阅读 · 1 评论 -
Leetcode summary: array element sum problem
Tag: Dictclass Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ dic={} r...原创 2019-04-30 16:34:20 · 110 阅读 · 0 评论 -
Leetcode Palindrome problem summary
class Solution: def helper(self,s,l,r): while l>=0 and r<len(s) and s[l]==s[r]: l=l-1 r=r+1 return s[l+1:r] def longestPalindrome(self, s...原创 2019-05-05 16:07:49 · 131 阅读 · 0 评论 -
Leetcode[451] Sort Characters By Frequency Medium
Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:“tree”Output:“eert”Explanation:‘e’ appears twice while ‘r’ and ‘t’ both appear once.So ‘e’ must...原创 2019-03-29 13:55:57 · 252 阅读 · 0 评论 -
Leetcode[25] Reverse Nodes in k-Group
增加一個pre 和next 節點進行鏈表内部的翻轉# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def...原创 2019-04-01 08:57:35 · 102 阅读 · 0 评论 -
Leetcode[344] Reverse String
Write a function that takes a string as input and returns the string reversed.Example:Given s = “hello”, return “olleh”.void inverse(int start, int end, char *p){ char temp; if(p) { temp=p[st...原创 2019-03-29 18:52:19 · 200 阅读 · 0 评论 -
Leetcode[389] Find the Difference
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added ...原创 2019-03-29 18:30:17 · 114 阅读 · 0 评论 -
Leetcode[136] Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra m...原创 2019-03-29 17:59:08 · 107 阅读 · 0 评论