Python Linked List: Inserting an Element After a Specific Node

Learn how to efficiently insert a new element after a specific node in a linked list using Python. Follow this step-by-step guide with code examples to understand the implementation details.

K-Means Clustering Algorithm

K-Means is a widely used clustering algorithm that partitions a set of data points into K clusters, where each cluster is defined by its centroid. The goal of the algorithm is to minimize the sum of squared distances between each data point and its closest centroid. The algorithm starts by randomly selecting K initial centroids […]

What are the good websites to learn data structures and algorithms?

Well! Programming is fun once you get it and the great part is a decent developer gets an enormous check from Top Tech Giants Like (Google, Amazon, Walmart, Microsoft, Facebook, and Apple). Data Structure and algorithms are needed for breaking interviews in these first-rate organizations. Regardless of whether you are a fledgling or middle in Algorithm abilities […]

Search an element in a sorted and rotated array

An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the […]

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


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


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 […]

Linear Search

Algo Cover

Given an array of n elements. We have to write a function to search an item X in the given array Arr[n] Examples : Input : arr[] = {10, 20, 80, 30, 60, 50,110, 100, 130, 170}x = 110;Output : 6Element x is present at index 6 Input : arr[] = {10, 20, 80, 30, […]

%d bloggers like this: