To insert node at the beginning of a linked list
1. Create a new node dynamically.
2. Insert a data and point the new node to the next node.
3. Put a reference of head node to the new node. So that head node points to new 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 selection sort program in C. How selection sort algorithm works and what’s their time complexity.
What is Selection Sort
Selection sort is an in-place comparison sort. Like bubble sort time complexity of Selection sort is also O(n^2). It is not suitable for large elements.
Bubble Sort program, Algorithm & their time complexity.In this tutorial, We are going to learn about bubble sort algorithm and their implementation in various programming languages.
In this tutorial, we are going to cover following things
- What is Bubble Sort?
- Bubble sort algorithm & it’s time complexity
- Bubble sort program in C & C++
- Java program to implement Bubble sort
- Bubble sort implementation in PHP
What is Bubble Sort?
Bubble sort is a sorting algorithm, It works by comparing each pair of adjacent elements and switching their positions if necessary. It repeats this process until all the elements are sorted.
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
Write a C program to print hello world without using semicolon. It’s an interesting problem as in C every line is terminated with a semicolon. So, how do we write a c program to print hello world without using semicolon.