Akhil Sharma has Published 550 Articles

Golang program to find minimum value in a stack

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:46:25

In Golang, we can find minimum value in a stack by using iterative method and optimized iterative method. A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Syntax func (s *Stack) getMin() int {…} The getMin() function is used to find the minimum value ... Read More

Golang program to find floor and ceil in binary search tree

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:44:21

A binary search tree (BST) is a type of binary tree where every node has at most two children, commonly referred to as the left child and the right child. In this Golang article, we will learn how to find floor and ceil in binary search tree using recursion and ... Read More

Golang program to reorder list using recursion

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:43:12

A linked list is a data structure consisting of a collection of nodes, where each node contains a value and a pointer to the next node in the list. In this Golang article, we will learn how to reorder list using recursion along with some helper functions. Syntax func ... Read More

Golang program to find the diameter of a tree

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:41:07

In this Golang article, we are going to find the diameter of a tree by using recursion and iterative method. The diameter of a tree is the number of nodes on the longest path between any two leaves in the tree. Syntax func diameter(root *node) int{…} The diameter() function ... Read More

Golang program to delete duplicate value nodes from a sorted linked list

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:39:48

In this Golang article, we are going to delete duplicate value nodes from a sorted linked list by using recursion and iterative method. A linked list is a data structure consisting of a collection of nodes, where each node contains a value and a pointer to the next node in ... Read More

Golang program to print left pascals triangle

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:36:56

In this Golang article, we will learn how to print left Pascal’s triangle by using recursion and iterative method. Pascal's triangle is a triangular array of binomial coefficients. The left pascal's triangle is a variant of Pascal's triangle that is obtained by reflecting Pascal's triangle along a vertical axis. Syntax ... Read More

Golang program to find maximum element in array using linear search

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:17:27

In this Golang article, we will learn how to find maximum element in array using linear search by using recursion and iterative method. Syntax func findMax(arr []int) int {…} The findMax() function is used to find maximum element in array using linear search iteratively. It takes an integer ... Read More

Golang program to find the first occurrence of a specific element in array using linear search

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 12:13:09

In this Golang article, we will find the first occurrence of a specific element in array using linear search by using recursion and iterative method. Linear search is a simple search algorithm that checks every element in a list or array one by one, starting from the beginning, until a ... Read More

Golang program to find minimum element in array using linear search

Akhil Sharma

Akhil Sharma

Updated on 10-May-2023 11:59:28

In this Golang article, we will learn how to find the minimum element in an array using linear search by using recursion and iterative method. An array is a collection of elements of the same data type, arranged in a contiguous block of memory, and accessed using an index or ... Read More

Golang program to return the values from the block

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 13:04:56

In this golang article, we will learn how to return the values from the block using external function, an anonymous function. A block is created using curly braces where the scope of variables remains inside the block and not outside of it. Example 1 In this Example, two values of ... Read More

1 2 3 4 5 ... 55 Next
Advertisements