### All content related to recursion Swap List Nodes in Pairs

Given a singly linked list, write a program to swap every two adjacent nodes and return its head. If the number of nodes are odd, then we need to pair-wise swap all the elements except the last element.

EnjoyAlgorithms Sort a stack using Stack

Given a stack, write a program to sort the stack in ascending order. We are not allowed to make any assumptions about how the stack is implemented. The only functions to be used are push(s, x), pop(s), top(s), isEmpty(s).

EnjoyAlgorithms Intersection of two Sorted Linked Lists

Given two sorted linked lists, write a program to find the intersections of the linked lists, and return the head of the new Linked List.

EnjoyAlgorithms Find all possible combinations of K numbers from 1 to n

Given two numbers n and K and you have to find all possible combinations of K numbers from 1 to n. This is a good interview problem to understand the concept of problem-solving using backtracking and combinatorics.

EnjoyAlgorithms Write a program to reverse a linked list. A head pointer of a linked list is given and our task to reverse the entire list so that when the resulted list is traversed it looks like we are traversing the original list from tail to head.

EnjoyAlgorithms Print a given matrix in spiral order

Given a 2-dimensional matrix, print the elements in spiral order. This is a good matrix problem to understand problem solving using both iteration and recursion.

EnjoyAlgorithms Recursive Tree Traversals of a Binary Tree: Preorder, Inorder and Postorder Traversal

To process data stored in a binary tree, we need to traverse each tree node, and the process to visit all nodes is called binary tree traversal. In this blog, we will be discussing three popular recursive tree traversals: preorder, inorder and postorder traversals. These traversals are also called depth-first search traversal or dfs traversal in data structures.

EnjoyAlgorithms Analysis of Recursion in Data Structure and Algorithms

Learning analysis of recursion is critical to understand the time complexity analysis of recursive algorithms. We will discuss these concepts related to the recursion analysis: Recurrence relations of recursive algorithms, steps to analyze the time complexity of recursion, Recursion tree method, and master theorem to analyze divide and conquer algorithms.

EnjoyAlgorithms Binary Search Algorithm: Fast Searching on Sorted Array!

The binary search is one of the fastest search algorithms, which searches a value in the sorted array in an O(logn) time complexity. Here we search a value using divide and conquer by repeatedly dividing the search interval in half. Moreover, the algorithm for binary search also helps us to solve several coding problems.

EnjoyAlgorithms Quicksort: one of the fastest sorting algorithms!

Quicksort is often the best practical choice for sorting because it works remarkably efficiently on average O(nlogn) time complexity. It is also one of the best algorithms to learn problem-solving using recursion and divide and conquer approach. In this blog, we have covered: 1) How quick sort works recursively? 2) Choosing a correct pivot value in the partition algorithm 3) Best, worst, and average-case time complexity analysis 4) Space complexity and essential properties of the quick sort. Explore and Enjoy!

EnjoyAlgorithms Recursion Explained: How recursion works in Programming?

Recursion means solving the problem via the solution of the smaller sub-problem. This blog will answer some critical questions like - what is recursion? What are its advantages and disadvantages? How do you identify recursion problems? What is the difference between recursion and iteration? etc.

EnjoyAlgorithms Merge Sort Algorithm

Merge sort is one of the fastest comparison-based sorting algorithms, which works on the principle of the divide and conquer approach. The worst and best case time complexity of merge sort is O(nlogn), and space complexity is O(n). It is also the best algorithm for sorting linked lists.

EnjoyAlgorithms