算法设计与分析(六)(上周第五周的写错标题,这才是真正的第六周)

Merge k Sorted Lists 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1-&a...

2018-10-11 19:30:11

阅读数:4

评论数:0

算法设计与分析(六)

Is Graph Bipartite? 1. 题目 Given an undirected graph, return true if and only if it is bipartite. Recall that a graph is bipartite if we can split it’...

2018-10-04 10:04:31

阅读数:9

评论数:0

算法设计与分析第四周练习(图论)

Network Delay Time 1. 题目 There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), whe...

2018-09-28 13:54:57

阅读数:10

评论数:0

算法分析与设计第三周练习(图论)

目录 Evaluate Division Reconstruct Itinerary 总结 Evaluate Division 1. 题目 Equations are given in the format A / B = k, where A and B are variables ...

2018-09-21 23:07:40

阅读数:10

评论数:0

算法设计与分析第二周练习

目录 Course Schedule(拓扑) Kth Largest Element in an Array(分治算法) Kth Largest Element in an Array 题目 Find the kth largest element in an unsorted arra...

2018-09-14 18:50:27

阅读数:15

评论数:0

算法设计与分析第一周练习

题目 Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e...

2018-09-07 00:01:37

阅读数:19

评论数:0

LeetCode--Keys and Rooms

Keys and Rooms 题目 There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys to...

2018-10-14 22:20:26

阅读数:4

评论数:0

3Sum

3Sum 1.题目 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array whic...

2018-09-24 23:49:16

阅读数:12

评论数:0

LeetCode--Longest Common Prefix

Longest Common Prefix 题目 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, retu...

2018-09-24 21:08:58

阅读数:14

评论数:0

LeetCode--Integer to Roman

Integer to Roman 1. 题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V ...

2018-09-23 23:16:13

阅读数:12

评论数:0

LeetCode--Roman to Integer

Roman to Integer 1. 题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V ...

2018-09-23 21:22:49

阅读数:10

评论数:0

LeetCode--Clone Graph

Clone Graph 1. 题目 Given the head of a graph, return a deep copy (clone) of the graph. Each node in the graph contains a label (int) and a list (Lis...

2018-09-23 20:03:36

阅读数:16

评论数:0

LeetCode--String to Integer (atoi)

String to Integer (atoi) 1 题目 Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as n...

2018-09-22 10:42:26

阅读数:12

评论数:0

LeetCode--Reverse Integer

Reverse Integer 题目 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Out...

2018-09-16 23:39:02

阅读数:12

评论数:0

LeetCode--ZigZag Conversion

ZigZag Conversion 题目 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may wan...

2018-09-16 21:36:49

阅读数:12

评论数:0

LeetCode--Search a 2D Matrix II(分治策略)

Search a 2D Matrix II 题目 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Inte...

2018-09-15 14:30:52

阅读数:15

评论数:0

LeetCode--Merge k Sorted Lists--分治策略

Merge k Sorted Lists--分治策略 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example Input: ...

2018-09-14 23:26:37

阅读数:9

评论数:0

LeetCode--Two Sum

Two Sum 题目 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each inpu...

2018-09-08 10:57:29

阅读数:13

评论数:0

二叉树

基本概念 结点的层次(Level)从根开始定义,根为第一层,根的孩子为第二层。 二叉树的高度:树中结点的最大层次称为树的深度(Depth)或高度。   二叉树 在计算机科学中,二叉树是每个结点最多有两个子树的有序树。通常子树的根被称作“左子树”(left subtree)和“右子树”(right ...

2018-01-10 15:09:29

阅读数:71

评论数:0

Ordering Tasks(优先工作)拓补排序

Ordering Tasks工具 queue vector 思路主要是处理好每个点的入度的关系,当一个节点的前驱节点全部被处理的时候,表示该节点能被处理,每处理一个节点,他对应的后序节点的入度都减1#include <iostream> #include <vector> ...

2017-12-24 21:34:01

阅读数:72

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭