![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
algorithm
文章平均质量分 79
OString2024
个人公众号:Waterfly
zhihu:Ostring
展开
-
[Algorithm] Design a link list with method: add, search and remove
struct Node{ valatile int val; struct Node* valatile next; struct mutex lock;}bool remove(struct Node*head, int val){ if (head==NULL) return false pre=head; cur=head.next; mutex_lock(pre....原创 2019-12-18 18:00:10 · 104 阅读 · 0 评论 -
[Algorithm]microsoft-a-string-into-sub-strings-with-additional-info-within-limited-length
https://leetcode.com/discuss/interview-question/439260/microsoft-phone-split-a-string-into-sub-strings-with-additional-info-within-limited-lengthExtend: append notation such as " (1 of 12)" and strin...原创 2019-12-17 19:00:30 · 108 阅读 · 0 评论 -
[Algorithm] 中文数字转换为阿拉伯数字
#coding=utf-8chs_arabic_map = {u'零':0, u'一':1, u'二':2, u'三':3, u'四':4, u'五':5, u'六':6, u'七':7, u'八':8, u'九':9, u'十':10, u'百':100, u'千':10 ** 3, u'万':10 ** 4, u'〇':0, u'壹':1, u...原创 2019-11-29 09:56:58 · 386 阅读 · 1 评论 -
[算法] 二叉排序树查找中位数
比较tricky的解法,不用额外的内存首先考虑将二叉树转换成双向链表[LeetCode] 426. Convert Binary Search Tree to Sorted Doubly Linked List将二叉搜索树转为有序双向链表然后通过查找链表中间节点的方法找到中位数def doubleconvert(root): if not root: return None ...原创 2019-11-14 19:44:01 · 1015 阅读 · 0 评论 -
单链表的快速排序和归并排序
# -*- coding: UTF-8 -*-class TreeNode(object): def __init__(self,val,nex): self.val=val self.next=nexdef linksort(s,e): if s==e: return key=s.val p=s ...原创 2019-11-14 16:23:13 · 112 阅读 · 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 · 432 阅读 · 0 评论 -
Leetcode[138] Copy List with Random Pointer
an error:keyerror,class Solution(object): def copyRandomList(self, head): """ :type head: Node :rtype: Node """ if head==None: return None ...原创 2019-04-13 22:38:46 · 88 阅读 · 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 · 225 阅读 · 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 · 71 阅读 · 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 · 162 阅读 · 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 · 92 阅读 · 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 · 81 阅读 · 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 · 10431 阅读 · 0 评论 -
人工智能的历史(History of artificial intelligence)
人工智能的历史起于远古时代,夹杂者神话故事和各种流言,正如帕梅拉( Pamela McCorduck)所说,远古人类创造AI 的初心是为了创造一个人造的上帝。比如希腊的金色机器人 火神赫菲斯托斯 和 Pygmalion’s Galatea。 在公元前第一个千禧年,中国,印度和希腊哲学家都提出了一些推理的研究理论,比如 亚里士多德(Aristotle)进行了演绎推理三段论的完整分析,欧几里得(......原创 2018-09-17 19:04:04 · 17767 阅读 · 2 评论 -
Leetcode Journey
数组按出现频次从大到小排序http://www.geeksforgeeks.org/amazon-interview-set-21/#include <stdio.h>typedef struct{int id;int count;}item;void sort(int a[], int n){item temp[n];原创 2018-05-23 10:42:14 · 192 阅读 · 0 评论 -
数据结构
《大话数据结构》,一本介绍常用数据结构的工具书,在毕业找工作时,一些容易遗忘的数据结构,通常随手在这本书中找到答案,并很快回忆起书中相关的代码实现方法,在笔试时起到了不小的作用。今天,重新整理下之前的笔记。@home chapter 01首先是一些基本概念:数据:计算机操作的对象数据元素:组成数据的基本单位。 数据项:数据元素可由若干个数据项组成数据对象:性质相同的数据元素...原创 2018-03-31 23:20:01 · 324 阅读 · 0 评论