Dev Prakash Sharma has Published 556 Articles

Bubble Sort in Go Lang

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:53:00

5K+ Views

Bubble Sort is a sorting algorithm that works by swapping the elements that are in the wrong order. In multiple passes, it checks if the adjacent elements are in the right order (increasing) or not.The Time Complexity of the Bubble Sort is O(n^2) since it takes two nested loops to ... Read More

Birthday Paradox in Python

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:50:17

1K+ Views

The birthday paradox is a very famous problem in the section of probability.Problem Statement − There are several people at a birthday party, some are having the same birthday collision. We need to find the approximate number of people at a birthday party on the basis of having the same ... Read More

Birthday Paradox in C++

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:47:09

490 Views

The birthday paradox is a very famous problem in the section of probability. The problem statement of this problem is stated as, There are several people at a birthday party, some are having the same birthday collision. We need to find the approximate no. of people at a birthday party ... Read More

Write a program in Python to replace all the 0’s with 5 in a given number

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 10:20:10

339 Views

Given an Integer N the task is to replace all the 0’s that appear in the number with ‘5’. However, the number with leading ‘0’ cannot be replaced with ‘5’ as it remains unchanged. For example, Input-1 −N = 1007Output −1557Explanation − The given number has 2 zeros which when ... Read More

Majority Element in Python

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 08:10:17

2K+ Views

Let’s suppose we have an array of integers. The task is to find the index of a particular element in the given array. For example, Input-1 −N = 8 A[ ] = { 1, 2, 4, 3, 3, 1, 1, 5}Output −1Explanation − In the given array of integers, the ... Read More

Counting elements in two arrays using C++

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 07:16:38

461 Views

Let us assume that we have given two unsorted arrays arr1[] and arr2[]. The task is to count the total number of elements in arr2[] for which each element of arr1[] are less than or equal to the elements present in arr2[]. However, the element in both the array may ... Read More

Advertisements