Data Structure & Algorithms Interview Questions

SA Questions

In this post we will be providing some questions frequently asked in Interview. Comment their answers below Arrays How do you find the missing number in a given integer array of 1 to 100? How do you find the duplicate number on a given integer array? How do you find the largest and smallest number […]

Program to cyclically rotate an array by one

Cover Pic

Given an array, cyclically rotate the array clockwise by one.  Examples: Input: arr[] = {1, 2, 3, 4, 5} Output: arr[] = {5, 1, 2, 3, 4} Following are steps for Array Rotation.  Store last element in a variable say x.  Shift all elements one position ahead.  Replace first element of array with x. Output […]

Program to find the pair with a given sum in an array

Cover Pic

We are given an array that is sorted and then rotated around an unknown point. Find if the array has a pair with a given sum ‘x’. It may be assumed that all elements in the array are distinct. Examples :  Input: arr[] = {11, 15, 6, 8, 9, 10}, x = 26 Output: true […]

C Program to implement Binary Search

C Program

We are given a sorted array of size n. We have to write program to find an element x in arr[]. In the previous post we have implemented linear search. Now we are going to implement another approach to search it. This approach is called Binary Search. Binary Search – Search an element in sorted […]

C Program to search an element in array

Array

Write a C program to input elements in array and search whether an element exists in array or not. How to search element in array linearly in C programming. Logic to search element in array sequentially in C program. Example Input Input size of array: 10 Input elements in array: 10, 12, 20, 25, 13, […]

C Program to delete an element from the array

Array

In this Post we’re going to learn how to delete an element from the array in 2 conditions Position of the element to be deleted is given. Elements to be deleted is given. Position of the element to be deleted is given. This C program is to delete an element from an array from a […]

C Program to Insert an element in array

Cover Pic

An array is a collection of items stored at contiguous memory locations. In this article, we will see how to insert an element in an array in C.Given an array arr of size n, this article tells how to insert an element x in this array arr at a specific position pos. For example we have to insert 100 at 3rd position. Algorithm Here’s how to […]

Types of Variables in C

A variable is a name of the memory location. It is used to store data. Its value can be changed, and it can be reused many times. It is a way to represent memory location through symbol so that it can be easily identified. Let’s see the syntax to declare a variable: There are 5 types of […]

5 Algorithms Every Programmer Should Know

 Programming algorithms are computer procedures that is a lot like a recipe (called a procedure) and tells your computer precisely what steps to take to solve a problem or reach a goal. Algorithms play an important role in the career of a software developer. Wondering why algorithm are important? Gives you an idea if your […]

C/C++ Program to Check if a Given String is Palindrome

C/C++ Program to Check if a Given String is Palindrome

The most asked questions in TCS/ Wipro/Infosys and other MNC.                                              Palindrome:  A string is called palindrome if its reverse of the string is the same as the original string. For Example: “GEEG”, “LOOL”,”AABBBAA”.

%d bloggers like this: