MCQ on Recursion
Recursion is the most important concept in computer science. In my previous posts, i have written about binary search implementation using recursion and difference between recursion and iteration.
These MCQ helps you to understand the concept of Recursion.
1) Which Data Structure is used to perform Recursion?
c) Linked List
Binary Search is a searching algorithm that finds the value in a sorted array in O(logN) time complexity. In my previous post i discuss how to implement binary search using iterative method. In this post i’ll explain how to implement binary search using recursion.
Binary Search Program, Algorithm & their Time Complexity. In this tutorial, You’ll learn about binary search algorithm, how it’s useful in searching and the time complexity of a binary search.
A Binary Search is used to search an element in a sorted array. Binary search is also known as half-interval search or logarithmic search. It works by comparing a value (value needs to search) to the middle element an array. If a value matches with the middle element then the position is returned otherwise the algorithm repeats if the value is less than or greater than the middle element.
A Binary search algorithm is efficient than the linear search algorithm. The time complexity of binary search is O(log(n)).
Write a program to print middle element of a linked list. It is also the most asked question in interviews. I assume you have a basic understanding of linked list and it’s concept.
Write a stack program in C using an array. Implement a stack data structure using an Array. In this tutorial, You are going to learn about stack data structure and it’s implementation in C using an array.
C Program to Implement a Stack using Linked List
What is a Stack Data Structure?
A Stack is a Data Structure, in which insertion and deletion operations are allowed only at one end. It worked on LIFO (Last In First Out) Principle. In LIFO, an element which inserted last must be the first element to be removed.
Write a C program to reverse a singly linked list. Given a linked list, write a method to reverse a singly linked list. In this tutorial, we are going to write a code to reverse a linked list using an iterative approach.
Write a C program to insert a node at the beginning of linked list. In this tutorial, we create a linked list and insert a new node at the beginning/head of linked list.
A Linked list is a linear data structure which consists a group of nodes and each node points to next node by means of a pointer. In Linked list, a node consists of two parts, a data and a pointer to next node.
What is recursion and how to use recursion in programming. If you are new to programming, then recursion concept is tough to understand. In this post, i’ll explain the concept of recursion with example.
What is Recursion ?
In Recursion, function call itself repeatedly, until the base condition is reached. It’s a much preferred way to write cleaner and shorter code for many complex problems.
Through recursion, you can reduce complex problem into smaller version.
Write a java program to find duplicate elements in an array. There are multiple ways through which we can find duplicate elements in an array. In this tutorial, I’ll discuss three ways to find duplicate elements in an array.
This question is also very important in terms of technical interviews.
Write a c program to swap two numbers without using third variable. Given two input numbers, We have to write a code to swap two numbers without using third variable. In my previous post, I have explained a c program to swap two numbers using third variable. This question is generally asked in an interview.
Programming questions on linked list
Swap two numbers using Bitwise XOR Operator