Articles on Trending Technologies

Technical articles with clear explanations and examples

Find a subset with greatest geometric mean in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 24-Oct-2019 208 Views

Here we have an array A with some elements. Our task is to find the subset where the geometric mean is maximum. Suppose A = [1, 5, 7, 2, 0], then the subset with greatest geometric mean will be [5, 7].To solve this, we will follow one trick, we will not find the mean, as we know that the largest two elements will form the greatest geometric mean, so the largest two elements will be returned as subset.Example#include using namespace std; void largestGeoMeanSubset(int arr[], int n) {   if (n < 2) {     cout max) {       second_max = max; ...

Read More

Find a pair with maximum product in array of Integers in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 24-Oct-2019 242 Views

Consider we have an array A, there are n different elements. We have to find a pair (x, y) from the array A, such that the product of x and y is maximum. The array may contain positive or negative elements. Suppose an array is like: A = [-1, -4, -3, 0, 2, -5], then the pair will be (-4, -5) as product is maximum.To solve this problem, we have to keep track four numbers, the positive_max, positive_second_max, negative_max, negative_second_max. At the end if the (positive_max * positive_second_max) is greater than (negative_max * negative_second_max), then return positive pairs, otherwise return ...

Read More

Binary Search in C++ program?

sudhir sharma
sudhir sharma
Updated on 24-Oct-2019 1K+ Views

binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the ...

Read More

An interesting time complexity question in C++

sudhir sharma
sudhir sharma
Updated on 24-Oct-2019 1K+ Views

Time complexity can be defined as the time required by the algorithm to run its average case.Let's see and calculate the time complexity of some of the basic functions.Methodvoid counter(int n){    for(int i = 0 ; i < n ; i++){       for(int j = 1 ; j

Read More

An Insertion Sort time complexity question in C++

sudhir sharma
sudhir sharma
Updated on 24-Oct-2019 1K+ Views

What is the time complexity of insertion sort?Time complexity is the amount of time taken by a set of codes or algorithms to process or run as a function of the amount of input.For insertion sort, the time complexity is of the order O(n) i.e. big O of n in best case scenario. And in the average or worst case scenario the complexity is of the order O(n2).What will be the time complexity of sorting when insertion sort algorithm is applied to n sized array of the following form: 6, 5, 8, 7, 10, 9 …… I, i-1The time complexity ...

Read More

Amortized analysis for increment in counter in C++

sudhir sharma
sudhir sharma
Updated on 24-Oct-2019 700 Views

Amortized analysis for a sequence of operations is used to determine the run time, the average time required by the sequence. In cannot be treated as an average-case analysis done on the algorithm as it does not always take the average case scenario. There are cases that occur as a worst-case scenario of analysis. So, amortized analysis can be treated as a worst-case analysis for multiple operations in a sequence. Here, the cost of doing each operations in different and for some its high. This problem is a general view using the binary counter.Let’s see the working and implementation in ...

Read More

Wot checks whether a site is safe in chrome

Samual Sam
Samual Sam
Updated on 23-Oct-2019 314 Views

Worldwide, there are numerous users who use web browser every day and every time for work, entertainment, e-commerce business, search, etc. So, it is necessary for users to know the online site which they can use to know the important task is safe or not. After knowing users requirement, Google chrome has come up with a very interesting extension “WOT”.“WOT” (Web of Trust) displays that on which websites user can belief based on various users’ experiences, worldwide. It facilitates users to visit safely on the website while searching, navigating, and purchasing online.It works on Windows (XP or later), Mac OS ...

Read More

Facebook is a great platform for charity fund

Samual Sam
Samual Sam
Updated on 23-Oct-2019 307 Views

Social networking channels like; Facebook, Twitter and MySpace are important advertising tools or platform, best for entertainment, advertisement, charity as well as business. Facebook thinks one step further in all aspect as compare to any other networking site and facilitates great Facebook’s fans to donate through donation button. Donation button is an application secures the donation money and sends it to the correct charity funds at the end of the month. To set up or get a donation button, user should be having a recognized charity name and a Facebook fan page, both. This article will facilitate Facebook fans to ...

Read More

How facebook page is helpful for business

Samual Sam
Samual Sam
Updated on 23-Oct-2019 200 Views

If someone is running a small business or company and added all company information at Facebook. The information provided through Facebook is interacting every day millions of people, millions of people go through his/her Facebook page to know the company owner better or his/her company’s product and services better, people can also share their own thoughts or suggestion on Facebook. Using Facebook, users can add and upload various stuffs like; build a custom page, run contests and promotions, and manage a small e-commerce shop that are not possible to do with any website. Additionally, it is free. Including all above ...

Read More

Now call facebook stream to google plus

Samual Sam
Samual Sam
Updated on 23-Oct-2019 156 Views

There are various successful social networking sites but no one can compare to Facebook and Google. Right now, nobody is there in this world that does not use Facebook and Google+ to increase their social network for business, entertainment, marketing, etc. Future of Facebook and Google+ is very bright with increasing number of fans and it will never go down in the market.The combination of “Facebook and Google+” is very useful for those fans who really want to see these two apps into one place, for fast access. To use this app, first install it then user can update their ...

Read More
Showing 56761–56770 of 61,297 articles
Advertisements