<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Algorithm - Tag - HEJTAO</title>
        <link>https://hejtao.netlify.app/tags/algorithm/</link>
        <description>Algorithm - Tag - HEJTAO</description>
        <generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 20 Sep 2023 00:00:00 &#43;0000</lastBuildDate><atom:link href="https://hejtao.netlify.app/tags/algorithm/" rel="self" type="application/rss+xml" /><item>
    <title>AlgoExpert Practice (Searching, Sorting, Greedy)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-search/</link>
    <pubDate>Wed, 20 Sep 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-search/</guid>
    <description><![CDATA[Searching Search in Sorted Matrix Unfold:Shifted Binary Search Unfold:Search for Range Unfold:func searchRange(nums []int, target int) []int { start := lowerBound(nums, target) if start == len(nums) || nums[start] != target{ return []int{-1, -1} } end := lowerBound(nums, target+1) - 1 return []int{start, end} } func lowerBound(nums []int, target int)int{ left, right := 0, len(nums)-1 for left &lt;= right{ mid := left+(right-left)/2 if nums[mid] &lt; target{ left = mid+1 }else{ right = mid - 1 } } return left } Index Equals Value Unfold:Median of Two Sorted Arrays Unfold:Optimal Assembly Line Unfold:Sorting Bubble Sort Insertion Sort Selection Sort Three Number Sort Unfold:Quick Sort Heap Sort Radix Sort Unfold:Merge Sort Unfold:Count Inversions Unfold:Greedy Algorithms Optimal Freelancing Unfold:Valid Starting City Unfold:]]></description>
</item>
<item>
    <title>AlgoExpert Practice (Graph, Famous Algorithms)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-graph/</link>
    <pubDate>Sat, 26 Aug 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-graph/</guid>
    <description><![CDATA[Graph Single Cycle Check Unfold:Breadth First Search Unfold:Degrees of Separation Unfold:River Sizes Unfold:Youngest Common Ancestor Unfold:Remove Islands Unfold:Cycle in Graph Unfold:Minimum Passes of Matrix Unfold:Two-Colorable Unfold:Boggle Board Unfold:Largest Island Unfold:Detect Arbitrage Unfold:Two Edge Connected Graph Unfold:Airport Connections Unfold:Famous Algorithms Kadane’s Algorithm Unfold:Stable internships Unfold:Union Find Unfold:Dijkstra’s Algorithm Unfold:Topological Sort Unfold:Kruskal’s Algorithm Unfold:Knuth Morris Pratt Algorithm Unfold:A* Algorithm Unfold:]]></description>
</item>
<item>
    <title>AlgoExpert Practice (BST, Binary Tree, Linked Lists)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-bst/</link>
    <pubDate>Fri, 18 Aug 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-bst/</guid>
    <description><![CDATA[Binary Search Trees BST Construction Unfold:Validate BST Unfold:func isValidBST(root *TreeNode) bool { return rec(root, -1&lt;&lt;63, 1&lt;&lt;63-1) } func rec(node *TreeNode, min, max int)bool{ if node == nil{ return true } v := node.Val return v &gt;= min &amp;&amp; v &lt; max &amp;&amp; rec(node.Left, min, v) &amp;&amp; rec(node.Right, v, max) } Find Kth Largest Value In BST Unfold:Reconstruct BST Unfold:Same BSTs Unfold:Validate Three Nodes Unfold:Repair BST Unfold:Largest BST Size Unfold:Right Smaller Than Unfold:Binary Tree Binary Tree Diameter Unfold:Find Successor Unfold:Max Path Sum in Binary Tree Unfold:func maxPathSum(root *TreeNode) int { ans := -1&lt;&lt;31 rec(root, &amp;ans) return ans } func rec(node *TreeNode, ans *int)int{ if node == nil{ return 0 } v := node.]]></description>
</item>
<item>
    <title>AlgoExpert Practice (Recursion, Heap, Tries)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-rec/</link>
    <pubDate>Mon, 07 Aug 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-rec/</guid>
    <description><![CDATA[Recursion Permutations Unfold:Powerset Unfold:Staircase Traversal Unfold:Blackjack Probability Unfold:Reveal Minesweeper Unfold:Longest Increasing Matrix Path Unfold:Lowest Common Manager Unfold:func lowestCommonAncestor(root, p, q *TreeNode) *TreeNode { if root == nil || root == p || root == q{ return root } left := lowestCommonAncestor(root.Left, p, q) right := lowestCommonAncestor(root.Right, p, q) if left != nil &amp;&amp; right != nil{ return root } if left != nil{ return left } return right } Interweaving Strings Unfold:Solve Sudoku Unfold:func solveSudoku(board [][]byte) { var rec func([][]byte)bool rec = func(board [][]byte)bool{ for row := 0; row &lt; 9; row++{ for col := 0; col &lt; 9; col++{ if board[row][col] == &#39;.]]></description>
</item>
<item>
    <title>AlgoExpert Practice (Strings, Stack)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-str/</link>
    <pubDate>Wed, 26 Jul 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-str/</guid>
    <description><![CDATA[Strings Common Characters Unfold:Longest Palindromic Substring Unfold:Group Anagrams Unfold:Valid IP Addresses Unfold:Reverse Words in String Unfold:Minimum Characters for Words Unfold:One Edit Unfold:Longest Substring Without Duplication Unfold:Underscorify Substring Unfold:Pattern Matcher Unfold:Smallest Substring Containing Unfold:Longest Balanced Substring Unfold:Stack Min Max Stack Construction Unfold:Balanced Brackets Unfold:Sunset Views Unfold:Best Digits Unfold:Sort Stack Unfold:Next Greater Element Unfold:Reverse Polish Notation Unfold:Colliding Asteroids Unfold:Shorten Path Unfold:Largest Rectangle Under Skyline Unfold:Largest Park Unfold:]]></description>
</item>
<item>
    <title>AlgoExpert Practice (Array)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-array/</link>
    <pubDate>Sat, 15 Jul 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-array/</guid>
    <description><![CDATA[Two Number Sum Unfold:Non-Constructible Change Unfold:Three Number Sum Unfold:func threeSum(nums []int) [][]int { res := [][]int{} sort.Ints(nums) n := len(nums) if n &lt; 3{ return res } for i := 0; i &lt; n-2; i++{ if i &gt; 0 &amp;&amp; nums[i] == nums[i-1]{ continue } left, right := i+1, n-1 for left &lt; right{ sum := nums[i]+nums[left]+nums[right] if sum &gt; 0{ right-- }else if sum &lt; 0{ left++ }else { res = append(res, []int{nums[i], nums[left], nums[right]}) left++ right-- for left &lt; right &amp;&amp; nums[left] == nums[left-1]{ left++ } if left &lt; right &amp;&amp; nums[right] == nums[right+1]{ right-- } } } } return res } Smallest Difference Unfold:Move Element to End Unfold:Longest Peak Unfold:Array of Products Unfold:First Duplicate Value Unfold:Best Seat Unfold:Zero Sum Subarray Unfold:Missing Numbers Unfold:Majority Element Unfold:Sweet and Savory Unfold:Longest Streak of Adjacent Ones Unfold:Balance Index Unfold:Repeated Matrix Values Unfold:Subarray Sort Unfold:Largest Range Unfold:Min Rewards Unfold:Zigzag Traverse Unfold:Longest Subarray with Sum Unfold:Knight Connection Unfold:Count Squares Unfold:Apartment Hunting Unfold:Calendar Matching Unfold:Waterfall Streams Unfold:Minimum Area Rectangle Unfold:Line Through Points Unfold:]]></description>
</item>
<item>
    <title>AlgoExpert Practice (DP)</title>
    <link>https://hejtao.netlify.app/posts/cs-algo-dp/</link>
    <pubDate>Mon, 10 Jul 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-algo-dp/</guid>
    <description><![CDATA[Max Subset Sum No Adjacent Unfold:Number of Ways to Make Change Unfold:Min Number of Coins for Change Unfold:Levenshtein Distance Unfold:Number of Ways to Traverse Graph Unfold:Max Sum Increasing Subsequence Unfold:Longest Common Subsequence Unfold:Min Number of Jumps Unfold:Water Area Unfold:Knapsack Problem Unfold:Disk Stacking Unfold:Numbers in Pi Unfold:Maximum Sum Submatrix Unfold:Maximize Expression Unfold:Dice Throws Unfold:Juice Bottling Unfold:Glob Matching Unfold:Max Profit with K Transactions Unfold:Palindrome Portioning Min Cuts Unfold:Longest Increasing Subsequence Unfold:Longest String Chain Unfold:Square of Zeroes Unfold:Max Subsequence Dot Product Unfold:]]></description>
</item>
<item>
    <title>Leetcode Practice</title>
    <link>https://hejtao.netlify.app/posts/cs-leetcode/</link>
    <pubDate>Tue, 19 Oct 2021 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-leetcode/</guid>
    <description><![CDATA[Array 704. Binary Search 👉 LeetCode
func search(nums []int, target int) int { left, right := 0, len(nums)-1 for left &lt;= right{ mid := （right - left) &gt;&gt; 1 + left if nums[mid] == target{ return mid }else if nums[mid] &lt; target { left = mid + 1 }else{ right = mid - 1 } } return -1 } Find The Single Number Example 1
input: nums = [2,2,3,3,4]
output: 4]]></description>
</item>
<item>
    <title>大话数据结构</title>
    <link>https://hejtao.netlify.app/posts/cs-data-structure/</link>
    <pubDate>Thu, 20 Dec 2018 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-data-structure/</guid>
    <description><![CDATA[3.4 顺序存储结构 数值 data(起始位置)；数组长度 MaxSize；线性表长度 length LOC($a_{i}$)=LOC($a_{1}$)+(i-1)c
3.6 链式存储结构 单链表，每个节点只包含一个指针域 头指针，头节点，第一个节点
package main import ( &#34;fmt&#34; ) type Node struct { data string next *Node } type LinkList struct { length int head *Node rear *Node } func NewLinkList(head *Node) *LinkList { return &amp;LinkList{0, head, head} } func (this *LinkList) Append(data string) { if this.rear == nil { return } node := &amp;Node{data: data} this.rear.next = node this.rear = node this.]]></description>
</item>
</channel>
</rss>
