Server Side Programming Articles - Page 2248 of 2650

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Path

Ravi Ranjan
Updated on 29-May-2025 19:17:56

1K+ Views

The Euler path is a path using which we can visit every edge exactly once in a graph. The same vertex can be used for multiple times. The source and destination nodes in the Euler path are different. If the source and destination node become the same, then the Eulerian path is also an Eulerian cycle. In this article, our task is to check if there exists an Eulerian path in the given undirected graph. Example of Eulerian Path The figure below displays an undirected graph and its respective adjacency matrix. As we can see there exists an Eulerian ... Read More

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Cycle

Ravi Ranjan
Updated on 28-May-2025 17:46:49

563 Views

The Euler path is a path by which we visit every edge exactly once while using the same vertices multiple times. When the starting and ending vertex of the Euler path is the same node (i.e., if a path starts from node 'A' and ends on node 'A'), it is also known as the Eulerian cycle. In this article, our task is to check if the Eulerian cycle exists in the given undirected graph or not. Example of Eulerian Cycle The figure below displays an undirected graph and its respective adjacency matrix. As we can see there exists ... Read More

C++ Program to Perform Sorting Using B-Tree

Chandu yadav
Updated on 30-Jul-2019 22:30:26

446 Views

Here we will see how to get the sorted sequence using B-Tree. The B-tree is n-ary tree. To get the sorted sequences, we can create a B-tree, then add the numbers into it. Here the B-tree can hold maximum 5 nodes. If number of nodes increases, split the node and form new level. As the nodes are holding few number of elements like 5 (at most), we are using Bubble sorting techniques to sort them. as the number of elements is very low, then it will not affect too much on its performance.After traversing the tree, we will get all ... Read More

Write a sorting algorithm for a numerical dataset in Python?

AmitDiwan
Updated on 12-Aug-2022 12:07:03

817 Views

Numerical Dataset in Python is for numerical datatypes. Sorting algorithm for integers, includes the following in Python − Bubble sort Shell sort Selection sort Bubble Sort in Python Bubble Sort is comparison-based sorting. The adjacent elements are compared and swapped to make the correct sequence − Example def bubblesort(myList): # Swap the elements to arrange in order for iter_num in range(len(myList)-1, 0, -1): for idx in range(iter_num): if myList[idx]>myList[idx+1]: temp = myList[idx] myList[idx] = myList[idx+1] myList[idx+1] = temp # Unsorted List myList = [40, 23, 7, 49, 32, 98, 76, 48, 87] print("Unsorted List = ", ... Read More

What is the difference between Cython and CPython?

AmitDiwan
Updated on 12-Aug-2022 12:09:59

9K+ Views

CPython CPython is the implementation of the language called “Python” in C. Python is an interpreted programming language. Hence, Python programmers need interpreters to convert Python code into machine code. Whereas Cython is a compiled programming language. The Cython programs can be executed directly by the CPU of the underlying computer without using any interpreter. Cython Cython is designed as a C-extension for Python. The developers can use Cython to speed up Python code execution. But they can still write and run Python programs without using Cython. But the programmers have to install both Python and C-compiler as a pre-requisite ... Read More

What is the process of compilation and linking in python?

AmitDiwan
Updated on 12-Aug-2022 12:51:26

7K+ Views

Compilation − The source code in python is saved as a .py file which is then compiled into a format known as byte code, byte code is then converted to machine code. After the compilation, the code is stored in .pyc files and is regenerated when the source is updated. This process is known as compilation. Linking − Linking is the final phase where all the functions are linked with their definitions as the linker knows where all these functions are implemented. This process is known as linking. image compilation.jpg----- Note − Python programs are both compiled as well as ... Read More

What is calendar module in python?

AmitDiwan
Updated on 11-Aug-2022 11:35:39

3K+ Views

The Calendar module in Python is used to display calendars and provides useful Built-in functions for displaying week, week day, month, month of the year, and other operations. By default, these calendars have Monday as the first day of the week, and Sunday as the last. Display the Calendar of an Year To display the calendar of an year, use the calendar() method and set year as the parameter − Example import calendar # Set the year year = 2022 # Display the calendar print(calendar.calendar(year)) Output ... Read More

Interpreter base classes in Python

Rishi Raj
Updated on 30-Jul-2019 22:30:26

528 Views

Python's interactive mode works on the principle of REPL (Read - Evaluate - Print - Loop). The code module in Python's standard library provides classes nd convenience functions to set up REPL environment from within Python script.Following two classes are defined in code module:InteractiveInterpreter: This class deals with parsing and interpreter state (the user’s namespace)InteractiveConsole: Closely emulate the behavior of the interactive Python interpreter.Two convenience functions in the module are:interact(): Convenience function to run a read-eval-print loop.compile_command(): This function is useful for programs that want to emulate Python’s interpreter main loop (the REPL).Interactive Interpreter methodsrunsource(): Compile and run some source ... Read More

Package extension utility in Python

Vikyath Ram
Updated on 30-Jul-2019 22:30:26

758 Views

When you want to add to the module search path for a specific package and work with resources included in a package, you need to use pkgutil module from Python library. It includes functions for changing the import rules for Python packages. It is also possible to load non-code resources from files distributed within a package.extend_path(path, name)Extend the search path for the modules which comprise a package. Intended use is to place the following code in a package’s __init__.pyimport pkgutil __path__ = pkgutil.extend_path(__path__, __name__)extend_path() scans sys.path for directories that include a subdirectory named for the package given as the second ... Read More

POP3 protocol client in Python

Rishi Raj
Updated on 30-Jul-2019 22:30:26

695 Views

The poolib module from Python's standard library defines POP3 and POP3_SSL classes. POP3 class encapsulates a connection to a POP3 server and implements the protocol as defined in RFC 1939. POP3_SSL classsupports POP3 servers that use SSL as an underlying protocol layer.POP3 protocolis obsolescent as its implementation quality of POP3 servers is quite poor. If your mailserver supports IMAP, it is recommended to use the imaplib.IMAP4 class.Both classes have following methods defined −getwelcome()Returns the greeting string sent by the POP3 server.user(username)Send user command, response should indicate that a password is required.pass_(password)Send password.Stat()Get mailbox status. The result contains 2 integers: (message ... Read More

Advertisements