Skip to content

Commit 0dc54e3

Browse files
committed
update notes
1 parent de1ffcc commit 0dc54e3

File tree

14 files changed

+504
-4
lines changed

14 files changed

+504
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ The notes are taken from the *Algorithms* course on Coursera ([Part I](https://w
99
1010
Resources link:
1111
- [Algorithms, 4th Edition](https://algs4.cs.princeton.edu/home/)
12-
- [Lecture PPT](https://algs4.cs.princeton.edu/lectures/)
12+
- [Lecture PPT](https://algs4.cs.princeton.edu/lectures/)
13+
- [Mathematics for Computer Science](https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/) (MIT Open Course)
14+
- [Introduction to Algorithms](https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011/) (MIT Open Course)

part-I/week1/percolation/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ASSESSMENT SUMMARY
22

3+
[Percolation](https://coursera.cs.princeton.edu/algs4/assignments/percolation/specification.php)
4+
5+
> Write a program to estimate the value of the percolation threshold via Monte Carlo simulation.
6+
7+
38
```
49
Compilation: PASSED
510
API: PASSED

part-I/week2/queues/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ASSESSMENT SUMMARY
22

3+
[Queues](https://coursera.cs.princeton.edu/algs4/assignments/queues/specification.php)
4+
5+
> Write a generic data type for a deque and a randomized queue. The goal of this assignment is to implement elementary data structures using arrays and linked lists, and to introduce you to generics and iterators.
6+
7+
38
```
49
Compilation: PASSED (0 errors, 2 warnings)
510
API: PASSED

part-I/week3/collinear/readme.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ASSESSMENT SUMMARY
22

3+
[Collinear Points](https://coursera.cs.princeton.edu/algs4/assignments/collinear/specification.php)
4+
5+
> Write a program to recognize line patterns in a given set of points.
6+
37
```
48
Compilation: PASSED
59
API: PASSED
@@ -79,10 +83,13 @@ Test 13: check that data type is immutable by testing whether each method
7983
==> FAILED
8084
```
8185

82-
### Solution of problem 1
86+
<details>
87+
<summary>Solution of problem 1</summary>
88+
8389
- make copy of input arguments in constructor
8490
- make copy in segments before return LineSegments
8591

92+
</details>
8693

8794
## Problem 2: timing
8895

@@ -134,11 +141,13 @@ Aborting: time limit of 10 seconds exceeded
134141
135142
```
136143

137-
### Solution of problem 2
144+
<details>
145+
<summary>Solution of problem 2</summary>
138146

139147
- Think about the line segment building process. The lowest end point of a line segment must be traversed in some step. So no need to add those line segment created by those point not in the end of this line segment, after sorting points on the line. So with this, no need to use loops to check duplicate, which will cost too much compareTo.
140148
- Sort the points before process can help lower cost of compareTo with the n-by-1 grid case. Because sorted input can lower cost.
141149

150+
</details>
142151

143152

144153
```

part-I/week4/8puzzle/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ASSESSMENT SUMMARY
22

3+
[Slider Puzzle](https://coursera.cs.princeton.edu/algs4/assignments/8puzzle/specification.php)
4+
5+
> Write a program to solve the [8-puzzle](https://en.wikipedia.org/wiki/15_puzzle) problem (and its natural generalizations) using the A* search algorithm.
6+
37
```
48
Compilation: PASSED
59
API: PASSED

part-I/week5/kdtree/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ASSESSMENT SUMMARY
22

3+
[kd-trees](https://coursera.cs.princeton.edu/algs4/assignments/kdtree/specification.php)
4+
5+
> Write a data type to represent a set of points in the unit square (all points have x- and y-coordinates between 0 and 1) using a 2d-tree to support efficient range search (find all of the points contained in a query rectangle) and nearest-neighbor search (find a closest point to a query point). 2d-trees have numerous applications, ranging from classifying astronomical objects to computer animation to speeding up neural networks to mining data to image retrieval.
6+
37
```
48
Compilation: PASSED
59
API: PASSED

0 commit comments

Comments
 (0)