How to begin with Competitive Programming? At the very beginning to competitive programming, barely anyone knows the coding style to be followed. Below is an example to help understand that style. Let us consider below problem statement as an example. Problem Statement: Linear Search: Given an integer array and an element x, find if element

# TagTechcodebit

## Commonly asked Interview Questions for Front End Developers

Commonly asked Interview Questions for Front End Developers 1) CSS, JS best practices? Strict mode, etc. 2) Mention some IE CSS issues faced by developers. 3) How to defer an element’s event handler if it depends on an external script that takes some time to load? 4) Optimal strategy for winning a game where let’s

## Find the Number Occurring Odd Number of Times

Find the Number Occurring Odd Number of Times Given an array of positive integers. All numbers occur even number of times except one number which occurs odd number of times. Find the number in O(n) time & constant space. Example: I/P = [1, 2, 3, 2, 3, 1, 3] O/P = 3 A Simple Solution

## Majority Element

Majority Element Majority Element: A majority element in an array A[] of size n is an element that appears more than n/2 times (and hence there is at most one such element). Write a function which takes an array and emits the majority element (if it exists), otherwise prints NONE as follows: I/P : 3

## Given an array A[] and a number x, check for pair in A[] with sum as x

Given an array A[] and a number x, check for pair in A[] with sum as x Write a C program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x. METHOD 1 (Use Sorting) Algorithm: hasArrayTwoCandidates (A[],

## Pseudo-polynomial Algorithms

Pseudo-polynomial Algorithms What is Pseudo-polynomial? An algorithm whose worst case time complexity depends on numeric value of input (not number of inputs) is called Pseudo-polynomial algorithm. For example, consider the problem of counting frequencies of all elements in an array of positive numbers. A pseudo-polynomial time solution for this is to first find the maximum

## What does ‘Space Complexity’ mean?

What does ‘Space Complexity’ mean? Space Complexity: The term Space Complexity is misused for Auxiliary Space at many places. Following are the correct definitions of Auxiliary Space and Space Complexity. Auxiliary Space is the extra space or temporary space used by an algorithm. Space Complexity of an algorithm is total space taken by the algorithm

## Analysis of Algorithm | Set 5 (Amortized Analysis Introduction)

Analysis of Algorithm | Set 5 (Amortized Analysis Introduction) Amortized Analysis is used for algorithms where an occasional operation is very slow, but most of the other operations are faster. In Amortized Analysis, we analyze a sequence of operations and guarantee a worst case average time which is lower than the worst case time of

## Analysis of Algorithms | Set 4 (Analysis of Loops)

Analysis of Algorithms | Set 4 (Analysis of Loops) We have discussed asymtotic analysis, best worst and average cases and asymptotic notations in previous posts. In this post, analysis of iterative programs with simple examples is discussed. 1) O(1): Time complexity of a function (or set of statements) is considered as O(1) if it doesn’t contain

## Analysis of Algorithms | Set 3 (Asymptotic Notations)

Analysis of Algorithms | Set 3 (Asymptotic Notations) We have discussed asymptotic analysis, and worst average and best cases of algorithms. The main idea of asymptotic analysis is to have a measure of efficiency of algorithms that doesn’t depend on machine specific constants, and doesn’t require algorithms to be implemented and time taken by programs