https://github.com/billryan/algorithm-exercise

Part I - Basics

Basic Data Structure

string:

s2 = "shaunwei"

s2.index('w') # return 5, if not found, throwValueError
s2.find('w') # return 5, if not found, return -1

linked list:

线性表有两钟结构:

顺序表 顺序存储结构(数组)、链表,链式存储结构

1.顺序表,顺序存储结构的线性表.

  特性是随机读取,也就是访问单个元素的时间复杂度是O(1)。

2.链表,链式存储的线性表。

  链式存储结构:就是两个相邻的元素在内存中可能不是相邻的,使用指针操作。

  优点是定点插入和定点删除的时间复杂度为 O(1),不会浪费太多内存,添加元素的时候才会申请内存,删除元素会释放内存。缺点是访问的时间复杂度最坏为O(n)。

algorithm-exercise的更多相关文章

  1. Stanford coursera Andrew Ng 机器学习课程编程作业(Exercise 1)

    Exercise 1:Linear Regression---实现一个线性回归 在本次练习中,需要实现一个单变量的线性回归.假设有一组历史数据<城市人口,开店利润>,现需要预测在哪个城市中 ...

  2. Conway's Game of Life: An Exercise in WPF, MVVM and C#

    This blog post was written for the Lockheed Martin Insight blog, sharing here for the external audie ...

  3. How to implement an algorithm from a scientific paper

    Author: Emmanuel Goossaert 翻译 This article is a short guide to implementing an algorithm from a scie ...

  4. Yandex.Algorithm 2011 Round 1 D. Sum of Medians 线段树

    题目链接: Sum of Medians Time Limit:3000MSMemory Limit:262144KB 问题描述 In one well-known algorithm of find ...

  5. nomasp 博客导读:Android、UWP、Algorithm、Lisp(找工作中……

    Profile Introduction to Blog 您能看到这篇博客导读是我的荣幸.本博客会持续更新.感谢您的支持.欢迎您的关注与留言.博客有多个专栏,各自是关于 Android应用开发 .Wi ...

  6. 18 A GIF decoder: an exercise in Go interfaces 一个GIF解码器:go语言接口训练

    A GIF decoder: an exercise in Go interfaces  一个GIF解码器:go语言接口训练 25 May 2011 Introduction At the Googl ...

  7. BP反向传播算法的工作原理How the backpropagation algorithm works

    In the last chapter we saw how neural networks can learn their weights and biases using the gradient ...

  8. 校内训练0602 习题exercise

    [题目大意] f(i)=((Af(i-1)+B)/(Cf(i-1)+D)) mod P. 给出f(0), A, B, C, D, P, n,求f(n). 多组数据T<=1e4 n<=1e1 ...

  9. [Algorithm] Heap data structure and heap sort algorithm

    Source, git Heap is a data structure that can fundamentally change the performance of fairly common ...

  10. BZOJ_2097_[Usaco2010 Dec]Exercise 奶牛健美操_二分答案+树形DP

    BZOJ_2097_[Usaco2010 Dec]Exercise 奶牛健美操_二分答案+树形DP Description Farmer John为了保持奶牛们的健康,让可怜的奶牛们不停在牧场之间 的 ...

随机推荐

  1. 深入Asyncio(十)异步解析式

    Async Comprehensions 目前已经学会了如何在Python中进行异步迭代,接下来的问题是这是否适用于解析式?答案是OJBK!该支持在PEP 530中提及,建议去读一下. >> ...

  2. 为什么引入TSS

    [0]README text description from orange's implemention of a os and for complete code ,please visit ht ...

  3. 导出到Excel中NPOI

    源地址:http://www.cnblogs.com/dreamof/archive/2010/06/02/1750151.html\ 1.NPOI官方网站:http://npoi.codeplex. ...

  4. Python中类方法、__new__方法和__init__方法解析

    在编程语言中创建一个类,有构造方法这样的一个术语.而在Python中,通常大家都认为__init__是构造方法,其实并不完全等同.在构建类中,有一个特殊的方法__new__,这个才能等同为构造方法. ...

  5. UIWebView使用中的内存相关问题

    本文转载至: http://blog.csdn.net/musou_ldns/article/details/7675589   applicationios5webkit测试cacheios 在iO ...

  6. 九度OJ 1154:Jungle Roads(丛林路径) (最小生成树)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:832 解决:555 题目描述: The Head Elder of the tropical island of Lagrishan has ...

  7. formData.append("username", "Groucho"); input 文件大小

    formData.append("username", "Groucho"); https://developer.mozilla.org/en-US/docs ...

  8. 【题解】CF264B Good Sequences

    [题解]CF264B Good Sequences 具有很明显的无后效性. 考虑\(dp\). 考虑初始条件,显然是\(dp(0)=0\) 考虑转移,显然是\(dp(t)=max(dp[k])+1\) ...

  9. 韩国版微信Kakao推出公链,能否用区块链实现全球扩张?

    2018年是属于区块链的一年,国内外巨头们纷纷布局区块链产业,前不久韩国最大的移动社交平台Kakao集团正式启动了旗下的第一个公链Klaytn的测试网. 此次宣布只是一次试探性举措,旨在对外公布Kla ...

  10. 20170326 ABAP调用外部webservice实例

    调用外部webservice 使用Tcode: SICF SPROXSET      设置创建proxy 的权限 SE80 SOAMANAGER 一.目的:调用外部SRM系统的 webservice: ...