- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 35164 Articles for Programming
6K+ Views
For detecting errors in digital data CRC is used, this is a good technique in detecting the transmission errors. In this technique mainly binary division is applied. In these technique, cyclic redundancy check bits are present which is a sequence of redundant bits, these bits are appended to the end of data unit so that the resulting data unit becomes exactly divisible by a second which is predetermined binary number. At the destination side, the incoming data is divided by the same number, if there is no remainder then assumed that data is correct and it’s ready to accept. A ... Read More
405 Views
Here two user input list is given, the elements of two lists are unsorted. Our task is to merged these two unsorted array and after that sort the list. Example Input: A [] = {100, 50, 150} B [] = {200, 30, 20} Output: Merge List:{20, 30, 50, 100, 150, 200} Algorithm Step 1: first we create two user input list. Step 2: Final merge list size is (size of the first list + the size of the second list). Step 3: then sort two list using sort() method. Step ... Read More
1K+ Views
Array is given, we have to find out maximum, minimum, secondlargest, second smallest number.AlgorithmStep 1: input list element Step 2: we take a number and compare it with all other number present in the list. Step 3: get maximum, minimum, secondlargest, second smallest number.Example code# To find largest, smallest, second largest and second smallest in a List def maxmin(A): maxi = A[0] secondsmax = A[0] mini = A[0] secondmini = A[0] for item in A: if item > maxi: maxi ... Read More
691 Views
Python provides sum function for calculating n number of element. Here we use this function and then calculate average. Algorithm Step 1: input “size of the list” Step 2: input “Element” Step 3: using sum function calculate summation of all numbers. Step 4: calculate average. Example code # Average of a list A=list() n=int(input("Enter the size of the List ::")) print("Enter the number ::") for i in range(int(n)): k=int(input("")) A.append(int(k)) sm=sum(A) avg=sm/n print("SUM = ",sm) print("AVERAGE = ",avg) Output Enter the size of the List ::5 Enter the number:: 10 20 30 40 50 SUM = 150 AVERAGE = 30.0
215 Views
Here we used anonymous (lambda) function inside the map() built-in function. In Python, anonymous function is defined without name, its defined using lambda keyword. Algorithm Step 1: input n Step 2: input p Step 3: use anonymous function. Step 4: display result. Example Code # To display the powers of any number using anonymous function n = int(input("Enter how many terms want to display??")) p = int(input("Enter the number want to calculate power ::")) # use anonymous function cal = list(map(lambda i: p ** i, range(n))) # display the result print("The total terms is ::>", ... Read More
602 Views
The string is given, our task is to find out the second repeated word. Here we Counter(iterator) for creating dictionary which contains word as key and its frequency as value. Algorithm Step 1: Create user define list. Step 2: Then convert list into a dictionary. Step 2: Next get the values and sort them in descending order. Step 3: Then the second element is the second largest value. Step 4: Next again traverse whole dictionary and display key whose value is equal to second largest element. Example code # To print Second most repeated word in a ... Read More
385 Views
Intersection operation means, we have to take all the common elements from List1 and List 2 and all the elements store in another third list. List1::[1, 2, 3] List2::[2, 3, 6] List3::[2, 3] Algorithm Step 1: input lists. Step 2: first traverse all the elements in the first list and check with the elements in the second list. Step 3: if the elements are matched then store in third list. Example code #Intersection of two lists def intertwolist(A, B): C = [i for i in A if i in B] ... Read More
454 Views
Union operation means, we have to take all the elements from List1 and List 2 and all the elements store in another third list. List1::[1, 2, 3] List2::[4, 5, 6] List3::[1, 2, 3, 4, 5, 6] Algorithm Step 1: Input two lists. Step 2: for union operation we just use + operator. Example code # UNION OPERATION A=list() B=list() n=int(input("Enter the size of the List ::")) print("Enter the Element of first list::") for i in range(int(n)): k=int(input("")) A.append(k) print("Enter the Element of second list::") for i in range(int(n)): ... Read More
137 Views
Given a positive a number and the range of the bits. Our task is to count unset bits in a range. Input : n = 50, starting address = 2, ending address = 5 Output : 2 There are '2' unset bits in the range 2 to 5. Algorithm Step 1 : convert n into its binary using bin(). Step 2 : remove first two characters. Step 3 : reverse string. Step 4 : count all unset bit '0' starting from index l-1 to r, where r is exclusive. Example Code # ... Read More
5K+ Views
Number is given, we have to check that the number is even or odd and positive or negative.AlgorithmStep 1: input number Step 2: check number is greater than equal to 0 or not. If true then positive otherwise negative and if it 0 then number is 0. Step 3: if number is divisible by 2 then it’s even otherwise its odd.Example code# Python program check if a number is Positive, Negative, Odd, Even, Zero n=int(input("Enter Number ::>")) if n >= 0: if n == 0: print("The Number Is Zero") else: print("This Is ... Read More