flatten_binary_tree_to_linked_list

package
v1.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2019 License: MIT Imports: 0 Imported by: 0

README

< Previous                  Next >

114. Flatten Binary Tree to Linked List (Medium)

Given a binary tree, flatten it to a linked list in-place.

For example, given the following tree:

    1
   / \
  2   5
 / \   \
3   4   6

The flattened tree should look like:

1
 \
  2
   \
    3
     \
      4
       \
        5
         \
          6

[Tree] [Depth-first Search]

Similar Questions

  1. Flatten a Multilevel Doubly Linked List (Medium)

Hints

Hint 1 If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL