Overview In the inorder traversal of a binary tree, we follow the below order Vist Left Subtree Visit Root Visit Right Subtree For example, let’s say we have below binary tree Then…
Blog
Preorder traversal of a Binary Tree in Go (Golang)
Overview In the preorder traversal of a binary tree, we follow the below order Visit Root Vist Left Subtree Visit Right Subtree For example, let’s say we have below binary tree Then…
Postorder traversal of a Binary Tree in Go (Golang)
Overview In the postorder traversal of a binary tree, we follow the below order Vist Left Subtree Visit Right Subtree Visit Root For example, let’s say we have below binary tree Then…
Remove duplicates from a sorted array in Go (Golang)
Overview The objective is to remove duplicates from a sorted array. Examples Program Below is the program for the same Output Note: Check out our Golang Advanced Tutorial. The tutorials in this…
Tic Tac Toe Complete Working Program in Go (Golang)
Overview Let’s first understand what is Tic Tac Toe with an example There is an n*n board and each block in the board can be marked with either a cross or a…
Add two binary numbers program in Go (Golang)
Overview The objective is to add two given binary numbers. Binary numbers are only composed of digits 0 and 1. Below is the binary addition logic for individual digits 0+0 = Sum…
Jump Game Program in Go (Golang)
Overview There is an input array provided. Each entry in the array represents the maximum jump length from that position. One is supposed to start from the first index and return true…
Convert a sorted linked list to balanced BST
Overview The objective is to convert a sorted linked list to a balanced BST. A balanced BST is a BST in which the depth of the two subtrees of every node never…
Construct a binary tree from postorder and inorder in Go (Golang)
Overview Two arrays are given which represent the postorder and inorder traversal of a binary tree. The objective is to construct a binary tree from them Example: Consider below tree Postorder traversal…
Construct a binary tree from preorder and inorder in Go (Golang)
Overview Two arrays are given which represent the preorder and inorder traversal of a binary tree. The objective is to construct a binary tree from them Example: Consider below tree Preorder traversal…