# 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”

Skip to content
# Tag: algorithm

## Two method on Leetcode 25. Reverse Nodes in k-Group

# 25. Reverse Nodes in k-Group

## Description

## Leetcode 666. Path Sum IV

# 666. Path Sum IV

## Counting Sort in JAVA

# Counting Sort

## Heap Sort in JAVA

# Heap Sort

## QuickSort and MergeSort in JAVA

# QuickSort

## Overview

## Leetcode 210. Course Schedule II

# 210. Course Schedule II

## Description

## Leetcode Some problems about Binary Search Tree

# 173. Binary Search Tree Iterator

## Description

## Leetcode No.78&90 Subsets

# 78. Subsets

## Description

## Leetcode No.48 Rotate Image

# Description

## Princeton Algorithm Assignment 1

## Programming Assignment 1: Percolation

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.

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?

Translate from my old Chinese blog

The page of assignment is following:

http://coursera.cs.princeton.edu/algs4/assignments/percolation.html