- 博客(5)
- 收藏
- 关注
原创 Coursear week4: Interview Questions: Priority Queues
Dynamic median.Design a data type that supports insert in logarithmic time, find-the-median in constant time, and remove-the-median in logarithmic time. If the number of keys in the data type is even...
2018-12-21 17:02:12 654
原创 Coursera week4 Programming Assignment 4: 8 Puzzle
题目链接8 puzzle题意简介拼图游戏,该拼图板是一个n*n的方格,但是只放了n*n-1个卡片,有一个空卡片便于我们移动,要求最后把拼图按照从上到下从左到右的顺序放卡片(1~n*n-1),求最少的步数。题目解析1、使用A*搜索算法,其实就是BFS的变体,每次选择优先级最高的节点出队列。我们直接使用老师提供的MinPQ数据结构即可。2、剪枝。代码中设计了一个数据结构,一个私有类——No...
2018-12-21 16:57:09 413
原创 Coursera Programming Assignment 2: Deques and Randomized Queues
完整代码如下Deque.javaimport java.util.Iterator;import java.util.NoSuchElementException;public class Deque<Item> implements Iterable<Item> { private Node first, last; private int N; ...
2018-12-08 12:07:41 267
原创 《Unix 网络编程1: 套接字联网(第3版)》源码编译
注:该书官网为Unix网络编程,源码下载地址为源码1. 编译过程如下$ tar -xzvf unpv13e.tar.gz // 解压文件夹$ cd unpv13e$ ./configure // 配置$ cd lib $ make$ cd ../libfree$ make // 在该步出错,解决方法往下看$ cd ../libroute$ make //这一步可能会出...
2018-12-03 11:28:10 293
原创 InterviewQuestion: Union–Find
Social network connectivity. Given a social network containing nn members and a log file containing mm timestamps at which times pairs of members formed friendships, design an algorithm to determine ...
2018-12-01 15:53:41 340
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人