Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1916 of 2650
3K+ Views
The return statement in python is an extremely useful statement used to return the flow of program from the function to the function caller. The keyword return is used to write the return statement. Since everything in python is an object the return value can be any object such as – numeric (int, float, double) or collections (list, tuple, dictionary) or user defined functions and classes or packages. The return statement has the following features - Return statement cannot be used outside the function. Any code written after return statement is called dead code as it will never ... Read More
2K+ Views
The Anonymous Functions in Python Python creates function objects when you write a lambda expression using the lambda keyword. These functions are called anonymous functions because they are not defined using the standard def keyword. These functions are useful when you need a small, single-line function to execute a single expression. Features of Anonymous Functions The following are the features of Anonymous Functions: It can be used wherever a function object is needed in your program, without assigning a name. A lambda function can take any number of arguments but can only ... Read More
6K+ Views
You may need to process a function for more arguments than you specified while defining the function. These arguments are called variable-length arguments and are not named in the function definition, unlike required and default arguments.SyntaxSyntax for a function with non-keyword variable arguments is this −def functionname([formal_args, ] *var_args_tuple ): "function_docstring" function_suite return [expression]An asterisk (*) is placed before the variable name that holds the values of all nonkeyword variable arguments. This tuple remains empty if no additional arguments are specified during the function call.Example Live Demo#!/usr/bin/python # Function definition is here def printinfo( arg1, *vartuple ): "This prints a variable passed arguments" ... Read More
2K+ Views
Data can be shifted between two computers implementing Socket programming in C.In same case, files can easily be sent implementing User Datagram Protocol(UDP) and a simple client/server.Security − Handled by encryption.Protocol − UDPEncryption − XOR encryptionAlgorithmThe server is started and waited for filename.A filename is sent by the client.This filename is received by the server. If file is present, server starts reading file and is continued to send a buffer filled with file contents encrypted until and unless file-end is reached.End of File is marked by EOF.File is received as buffers until and unless EOF is received. After that it ... Read More
512 Views
Binomial Heap is defined as an extension of Binary Heap that provides faster merge or union operation together with other operations provided by Binary Heap.A Binomial Heap is treated as a collection of Binomial Trees.What is a Binomial Tree?A Binomial Tree of order k can be built by taking two binomial trees of order k-1 and treating one as leftmost child or other.A Binomial Tree of order k has below properties.The number of nodes of Binomial Tree has exactly 2k.The depth of Binomial Tree is k.There are exactly kCi nodes at depth i where i = 0, 1, . . ... Read More
748 Views
In case of a given Binary Tree, convert it to a Binary Search Tree in such a way that keeps the original structure of Binary Tree intact.Sets of C++ STL will be used by this solution instead of array based solution.ExamplesExample 1Input 11 / \ 3 8 / \ 9 5Output 9 / \ 5 11 / \ 3 8Example 2Input 11 / \ 31 16 / \ 21 ... Read More
9K+ Views
Required arguments are the arguments passed to a function in correct positional order. Here, the number of arguments in the function call should match exactly with the function definition.To call the function printme(), you definitely need to pass one argument, otherwise it gives a syntax error as follows −Example Live Demo#!/usr/bin/python # Function definition is here def printme( str ): "This prints a passed string into this function" print str return; # Now you can call printme function printme()OutputWhen the above code is executed, it produces the following result −Traceback (most recent call last): File "test.py", line 11, in printme(); TypeError: ... Read More
897 Views
2’s Complement Number System is widely implemented in computer architecture.N-bit 2’s Complement number System can be able to represent Number from -2n-1 to 2n-1- 14 Bit can be able to represent numbers from ( -8 to 7 )5 Bit can be able to represent numbers from ( -16 to 15 ) in 2’s Complementary System.Overflow happens with respect to addition when 2 N-bit 2’s Complement Numbers are appended and the answer is too large to fit into that N-bit Group.A computer contains N-Bit Fixed registers. Result of addition of two N-Bit Number will result maximum N+1 Bit number.Carry Flag stores ... Read More
457 Views
In case of comparing with a flat array of numbers, the Fenwick tree results a much better balance between two operations: element update and prefix sum computation. In case of a flat array of m numbers, we can either store the elements, or the prefix sums. In case of first instance, calculating prefix sums needs linear time; in case of second instance, modifying or updating the array elements needs linear time (in both instances, the other operation can be accomplished in constant time). Fenwick trees permit both operations to be accomplished in O(log m) time. This is obtained by representing ... Read More
4K+ Views
In case of given m elements of different weights and bins each of capacity C, assign each element to a bin so that number of total implemented bins is minimized. Assumption should be that all elements have weights less than bin capacity.ApplicationsPlacing data on multiple disks.Loading of containers like trucks.Packing advertisements in fixed length radio/TV station breaks.Job scheduling.ExampleInput: weight[] = {4, 1, 8, 1, 4, 2} Bin Capacity c = 10 Output: 2 We require at least 2 bins to accommodate all elements First bin consists {4, 4, 2} and second bin {8, 2}Lower BoundWe can always calculate a lower ... Read More