algorithm-exercise
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的更多相关文章
- Stanford coursera Andrew Ng 机器学习课程编程作业(Exercise 1)
Exercise 1:Linear Regression---实现一个线性回归 在本次练习中,需要实现一个单变量的线性回归.假设有一组历史数据<城市人口,开店利润>,现需要预测在哪个城市中 ...
- 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 ...
- 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 ...
- Yandex.Algorithm 2011 Round 1 D. Sum of Medians 线段树
题目链接: Sum of Medians Time Limit:3000MSMemory Limit:262144KB 问题描述 In one well-known algorithm of find ...
- nomasp 博客导读:Android、UWP、Algorithm、Lisp(找工作中……
Profile Introduction to Blog 您能看到这篇博客导读是我的荣幸.本博客会持续更新.感谢您的支持.欢迎您的关注与留言.博客有多个专栏,各自是关于 Android应用开发 .Wi ...
- 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 ...
- BP反向传播算法的工作原理How the backpropagation algorithm works
In the last chapter we saw how neural networks can learn their weights and biases using the gradient ...
- 校内训练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 ...
- [Algorithm] Heap data structure and heap sort algorithm
Source, git Heap is a data structure that can fundamentally change the performance of fairly common ...
- BZOJ_2097_[Usaco2010 Dec]Exercise 奶牛健美操_二分答案+树形DP
BZOJ_2097_[Usaco2010 Dec]Exercise 奶牛健美操_二分答案+树形DP Description Farmer John为了保持奶牛们的健康,让可怜的奶牛们不停在牧场之间 的 ...
随机推荐
- C#使用for循环移除HTML标记
public static string StripTagsCharArray(string source) { char[] array = new char[source.Length]; int ...
- Java知识点梳理——泛型
1.定义:泛型的本质是参数化类型,就是将类型由原来的具体的类型参数化,这种参数类型可以用在类.接口.方法中,分别称为泛型类.泛型接口.泛型方法: 2.泛型类:泛型类的声明和非泛型类的声明类似,除了在类 ...
- 基于EasyNVR+EasyDSS H5视频直播二次开发实现业务需求:直接使用播放页面
之前的"网页直播.微信直播技术解决方案:EasyNVR与EasyDSS流媒体服务器组合之区分不同场景下的easynvr"有介绍一些功能.由于客户需求,我们定制一下功能.给该套方案添 ...
- 九度OJ 1156:谁是你的潜在朋友 (并查集)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5802 解决:2593 题目描述: "臭味相投"--这是我们描述朋友时喜欢用的词汇.两个人是朋友通常意味着他们存在着许多 ...
- 空间Rm的任意两个范数都互相等价
- 【题解】At2370 Piling Up
[题解]At2370 Piling Up \[ dp(i,j,0/1) \\ 正在进行i项操作并且此时黑球剩下j个,黑球[0/1]数量曾经到过0 \\ 为什么加第二位,判重.怎么想到的? \] 非常神 ...
- SQL2005数据库放在C盘,结果C盘满了,怎么搞到D盘
首先,你需要将自己所建立的数据库从SQL2005中分离出来,然后按照自己的存储路径找到自己所建数据库存储的位置,把它剪切到D盘就可以了.(mdf,ldf都应该考过去,自己建立路径存储就可以,再次打开的 ...
- X86汇编 BT
位操作指令位操作指令包括位测试和位扫描指令,可以直接对一个二进制位进行测试,设置和扫描. 1位测试和设置指令 格式:BT DEST,SRC BTC DEST,SRC BTR DEST,SRC BTS ...
- Web框架和Django基础
核心知识点 1.web应用类似于一个socket客户端,用来接收请求 2.HTTP:规定了客户端和服务器之间的通信格式. 3.一个HTTP包含两部分,header和body,body是可选,\r\n分 ...
- Java for LeetCode 131 Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome. Return all ...