Tree is a discrete structure that represents hierarchical relationships between individual elements or nodes. A tree in which a parent has no more than two children is called a binary tree.Tree and its PropertiesDefinition − A Tree is a connected acyclic undirected graph. There is a unique path between every ... Read More

The calendar module in python has features to handle all the features related to calendar and dates. It is one of the very extensively used module which has many in-built functions to use dates in the python programs.Example Live Demoimport calendar print(calendar.calendar(2019))OutputRunning the above code gives us the following result − ... Read More

Hamiltonian graph - A connected graph G is called Hamiltonian graph if there is a cycle which includes every vertex of G and the cycle is called Hamiltonian cycle. Hamiltonian walk in graph G is a walk that passes through each vertex exactly once.Dirac's Theorem - If G is a ... Read More

There are various types of graphs depending upon the number of vertices, number of edges, interconnectivity, and their overall structure. We will discuss only a certain few important types of graphs in this chapter.Null GraphA graph having no edges is called a Null Graph.ExampleIn the above graph, there are three ... Read More

Let us first create a table −mysql> create table DemoTable649 (Value text); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable649 values('1903'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable649 values('9321010'); Query OK, 1 row affected (0.14 ... Read More

The inverse of a one-to-one corresponding function f: A → B, is the function g: B → A, holding the following property −f(x) = y ⇔ g(y) = xThe function f is called invertible if its inverse function g exists.ExampleA Function f : Z → Z, f(x)=x+5, is invertible since ... Read More

Graph traversal is the problem of visiting all the vertices of a graph in some systematic order. There are mainly two ways to traverse a graph.Breadth First SearchDepth First SearchDepth First Search (DFS) algorithm starts from a vertex v, then it traverses to its adjacent vertex (say x) that has ... Read More

Let us first create a table. One of the columns is set as TIMESTAMP −mysql> create table DemoTable648( UserId int NOT NULL AUTO_INCREMENT, UserLoginTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARYKEY(UserId) ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command. Here, we ... Read More

Two graphs G1 and G2 are said to be homomorphic, if each of these graphs can be obtained from the same graph 'G' by dividing some edges of G with more vertices. Take a look at the following example −Divide the edge 'rs' into two edges by adding one vertex.The ... Read More

Use RAND() for random, whereas LIMIT 3 for the number of values i.e. 3 here −select yourColumnName from yourTableName order by rand() limit 3;Let us first create a table −mysql> create table DemoTable646 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(100) ); Query OK, 0 rows affected ... Read More