# Category Archives: Data Structures

## Find two numbers from their sum and XOR | Set 2

Given two integers X and Y, the task is to find the two integers having sum X and Bitwise XOR equal to Y. Examples: Input:… Read More »

## Improving Linear Search Technique

A linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until… Read More »

A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list… Read More »

## Count number of times each Edge appears in all possible paths of a given Tree

Given an Undirected Connected Graph in the form of a tree consisting of N nodes and (N – 1) edges, the task for each edge… Read More »

## Count of root to leaf paths in a Binary Tree that form an AP

Given a Binary Tree, the task is to count all paths from root to leaf which forms an Arithmetic Progression. Examples:  Input:   Output: 2 Explanation: The paths… Read More »

## Shortest path in a complement graph

Given an undirected non-weighted graph G. For a given node start return the shortest path that is the number of edges from start to all… Read More »

## Count of elements on the left which are divisible by current element | Set 2

Given an array A[] of N integers, the task is to generate an array B[] such that B[i] contains the count of indices j in… Read More »

## Count of triplets in an Array (i, j, k) such that i < j < k and a[k] < a[i] < a[j]

Given an array arr[] of N integers, the task is to count number of triplets (i, j, k) in the array such that a[k] <… Read More »

## Print sublist of a given Linked List specified by given indices

Given a Linkedlist and two indices A and B, the task is to print a sublist starting from A and ending at B. Examples: Input:… Read More »

## Comparison between Lists and Array in Python

Python List Python programming language has four collection data types namely List, Tuple, Set, and Dictionary. A list is a mutable and ordered collection i.e.,… Read More »

## Binary Search Tree | Set 3 (Iterative Delete)

Given a binary search tree and a node of the binary search tree, the task is to delete the node from the Binary Search tree… Read More »

## C program to implement Adjacency Matrix of a given Graph

Given a undirected Graph of N vertices 1 to N and M edges in form of 2D array arr[][] whose every row consists of two… Read More »

## Sum of all Palindrome Numbers present in a Linked list

Given a linked list with integer node values, the task is to find the sum of all Palindrome Numbers present as Node values. Examples: Input:… Read More »

## Sum of all perfect numbers present in an Linked list

Given an Linked list containing N positive integer, the task is to find the sum of all the perfect numbers from the list.  A number… Read More »

## Program to delete all even nodes from a Singly Linked List

Given a singly linked list containing N nodes, the task is to delete all the even nodes from the list.  Examples:   Input: LL = 1… Read More »