
作业代码
文章平均质量分 59
写作业
李槐安
这个作者很懒,什么都没留下…
展开
-
Minimum Spanning Tree
DescriptionLet G=(V,E) be an undirected, connected, weighted graph who is represented as an adjacency matrix. Find the minimum spanning tree of G. A minimum spanning tree is a least-cost subset of the edges of a graph that connects all the nodes.Input原创 2021-11-08 23:37:25 · 181 阅读 · 0 评论 -
Longest Common Subsequence
DescriptionImplement the LCS algorithm introduced in the class. You are required to output all possible LCS. The output set of LCS should in lexicographical order. Same LCS only need to output once.ExamplesInput:springtimeprintingOutput:prin原创 2021-11-08 23:28:57 · 104 阅读 · 0 评论 -
KD Tree
Problem DescriptionImplement a k-d Tree(in this problem k=2) and support the following operations:insert: Insert a new node with key into the k-d tree. search: Search the node with the given key. remove: Remove the node with the given key. findMin:原创 2021-11-03 17:22:06 · 167 阅读 · 0 评论 -
Trie Tree
Problem DescriptionImplement a Trie(prefix tree) and support the following operations:insert: insert a string into the Trie. search: return true if the queried string has been inserted into the Trie. startsWith: return true if there is any string in原创 2021-11-03 17:18:27 · 124 阅读 · 0 评论 -
Find the k-th largest element in an array
Input FormatThe program takes as input two lines.The first line is an unsorted array of integers in the range of [0,255].The second line is an integer k that 1≤k≤arraylength.Output FormatThe k-th largest element of the given array.NoteDO NOT.原创 2021-10-25 16:42:47 · 154 阅读 · 0 评论 -
Cuckoo Hashing
We will implement Cuckoo Hashing here, which is a simple hash table with worst-case O(1) lookups and deletions.Cuckoo Hashing maintains two tables, each of which has m elements. Given an array X⊂N+, each element x∈X will either be at position h1(x) in t原创 2021-10-25 16:32:13 · 244 阅读 · 0 评论 -
Newton Interpolation
The main function takes as input two sequences of numbers and one single number. The first sequence represents [x1,x2,…,xi] of some points, and the second sequence represents [y1,y2,…,yi]. You need to find the Newton interpolating polynomial to pass原创 2021-10-23 23:06:49 · 326 阅读 · 0 评论 -
Lagrange Interpolation
The main function takes as input two sequences of numbers and one single number. The first sequence represents [x1,x2,…,xi] of some points, and the second sequence represents [y1,y2,…,yi]. You need to find the Lagrange interpolating polynomial to pas原创 2021-10-23 23:04:17 · 291 阅读 · 0 评论 -
Gaussian Elimination for solving a linear system
Problem DescriptionUse Gaussian Elimination to solve a linear system Ax = b. The input is in the form of the augmented matrix [A b]. A system of linear equations can have no solution, a unique solution or infinitely many solutions. The output should be a原创 2021-10-23 22:08:06 · 282 阅读 · 0 评论 -
Newton‘s Method for Solving a Polynomial Equation
Problem DescriptionUse Newton's method to solve a polynomial equation. The equation can be represented asThe input contains two lines. The first line contains an integer n. The second line contains n+1 floating point numbers a0,...,an.ExamplesW..原创 2021-10-23 22:40:36 · 174 阅读 · 0 评论 -
H-Index
Given an array of integers citations where citations[i] is the number of citations a researcher received for their i-th paper. Please compute the researcher's h-index.According to the definition of h-index on Wikipedia: A scientist has an index h if h of原创 2021-10-23 22:47:33 · 360 阅读 · 0 评论