25. Reverse Nodes in k-Group
Description
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
Continue reading “Two method on Leetcode 25. Reverse Nodes in k-Group”
SY -> CS -> LA -> SEA
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
Continue reading “Two method on Leetcode 25. Reverse Nodes in k-Group”
If the depth of a tree is smaller than 5
, then this tree can be represented by a list of three-digits integers.
Chromebook is a very great education tool for students, especially in the US. Basically, the aim for me to use Chromebook is recording something in classes, codeing on Leetcode and watching vedios etc. About ten hours life time and light weight enable me to use it everywhere.
There is a detailed explanation in the book In troduction to Algorighms, Third Edition
and Wikipedia.
HeapSort, is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the maximum element and place the maximum element at the end. We repeat the same process for remaining element.
QuickSort is a very famous sort algorithm, Arrays.sort
is realized by QuickSort.
The basic method is following:
1. Choosing a pivot
, always the lowest value.
2. Dividing the array into two parts, the lower part will be put left of the pivot
, and the larger part is right.
3. With each round, the pivot
will move to the final position in the array.
4. Repeat the process, until the sort is completed.
There are a total of n courses you have to take, labeled from 0 to n - 1
.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Continue reading “Leetcode Some problems about Binary Search Tree”
There are to algorithm problem about backtracking.
Given a set of distinct integers, nums, return all possible subsets.
Note: The solution set must not contain duplicate subsets.
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?