2019-10-7

Autumn is around the corner:
Keep moving forward, looking for summer internship

what I want to do:

  • do more leetcode practice
  • get a good grade ( ML, Database )
  • work hard to finish school project (build a website, visualize data)

やさしさに包まれたなら

other pictures:

python_sort

Python sorting

sorted() : returns a new list
list.sort() : modifies the list in-place and only defined for list

Let’s look at some example :

using sorted()

1
2
3
example = [7,4,3,1,2]
sorted(example)
print(example)

example not ordered after calling sorted:
output : 7, 4, 3, 1, 2

1
2
after_sort = sorted(example)
print(after_sort)

assign to new list after_sort
output : 1, 2, 3, 4, 7

using list.sort()

1
example.sort()

output is sorted : 1, 2, 3, 4, 7

using itemgetter()

1
2
3
4
from operator import itemgetter
student = [["D",10],["C",10],["B",10],["A",10],["G",4]]
student.sort(key=itemgetter(1,0))
print(student)

first order by number (itemgetter(1))
then order by alphabet ( itemgetter(0))
output : [[‘G’, 4], [‘A’, 10], [‘B’, 10], [‘C’, 10], [‘D’, 10]]

hackerrank :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from operator import itemgetter
store_stu = []
min = 1000
if __name__ == '__main__':
for _ in range(int(input())):
name = input()
score = float(input())
if score < min:
min = score
store_stu.append([name,score] )
store_stu = sorted(store_stu, key = itemgetter(1,0) )
flag_small = 0
for i,j in store_stu:
if j > min and flag_small==0:
flag_small = j
if flag_small == 0:
flag_small = min
for i,j in store_stu:
if j == flag_small:
print(i)

About me

My name is Chun Hua Lu

My major is applied data science, and my bachelor degree is in computer science

I love to draw and write blog in my free time. I have experience in data science, computer networking, web development. Nice to meet you.
programming languages I use
  • python (pandas, numpy, matplotlib, sklearn)
  • C++
  • web technology
    • frontend (html, css, javascript)
    • backend (node.js)
    • special library (simpleWebrtc, socket.io)
  • git
  • matlab
  • C# (Unity)
  • Java (processing)
major courses

ongoing :

  • INF 551 Foundations of Data Management :
    Firebase, JSON, Hadoop, Spark, SQL, NoSQL, Amazon AWS
  • INF 552 Machine Learning for Data :
    Use python to implement and analyze Machine Learning algorithms

lintcode-615

description : lintcode 615

topology sorting

dag (directed acyclic graph) => G = ( V, E )

  • linear ordering
  • no cycle

topology sort (G)

  1. store neighbor in dictionary edge
  2. compute indegree
  3. find node where indegree == 0 & add to queue
  4. use bfs ( add 1 to count visited node, and decrease indegree by 1 )
  5. if indegree of beighbor node reduce to 0 add into queue

solution : 615 solution

G = (V, E)
time analysis: O (V+E)

2019/9/27

I draw in my free time

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×