본문 바로가기

Javascript

(15)
정규식 문자열 찾기 ^.*문자열.*$\n ^ 처음부터 .* 모든 n개의 문자 $ 개행미포함 \n 개행 (\n 또는 \r\n 으로 개행이 적용될 수 있음.) IntelliJ 에서는 .* 표시 버튼으로 정규식 활성화. 대부분의 에디터에서는 Ctrl + H 단축키로 적용됨.
Dynamic Programming A method for solving a complex problem by breaking it down into collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions. 'dynamic' was chosen by Bellman to capture the time varing aspect of the problems. 'programming' didn't refer to computer programming but to finding an optimal program n the same way. It only works on problems with optimal su..
Dijkstra's Algorithm one of the most famous and widely used algorithms the shortest path between the vertices. Edsger Dijkstra, a Dutch programmer Useful for GPS - finding fastest route Network Routing - finds open shortest path for data Biology - used to model the spread of viruses among humans Airline tickets - finding cheapest route to your destination Many other uses! thr first thing is we need to do is adding a..
Graph Traversal Graph Traversal Uses Peer to peer networking Web crawlers Finding the closest matches/recommendations Shortest path problems(GPS, Solving mazes, AI) In a Tree, depth first means moving away from the route. unlike a tree, we need to specify the starting point. when it comes to depth first traversal, it is finding one neighbor following one neighbor. It is really important, we remember where we've..
Graphs Essential Graph Terms Vertex - a node Edge - connection between nodes Weighted / Unweighted - values assigned to distances between vertices. each edge has value associated with it or not. Directed / Undirected - directions assigned to distanced between vertices one way or both way relationship or not. the polarity of the edges. facebook : directed graphs, instagram: undirected graphs. Two diffen..
Merge Sort There is a family of sorting algorithms that can improve time complexity from O(n^2) to O(n log n) It was created by Jonathan Van Norman in 1948. it is a combination of two things - merging and sorting. it works by decomposing an array into smaller arrays, spliting up the larger array we are trying to sort into smaller sub arrays all the way down. first, splitting up until we end up with sorted ..
Insertion Sort Builds up the sort by gradually creating a larger left half which is always sorted taking an element one at a time and inserting it in the correct spot. Insertion Sort Pseudocode Start by picking the second element in the array Now compare the second element with the one before it and swap if necessary. Continue to the next element and if it is in the incorrect order, iterate through the sorted ..
Selection Sort similar to bubble sort. but instead of first placing large values into sorted position, the actual sorted data is accumulating at the beginning. Selection Sort Pseudocode Store the firtst element as the smallest vlaue you've seen so far. Compare this item to the next item in the array until you find a smaller number If a smaller number is found, designate that smaller number to be the new 'minim..