Program for Insertion and Deletion at the beginning of Singly Linked List in Python

python program for the insertion and deletion operation at the beginning of singly linked list is given below. In this program we have two method. insert_at_beg() to insert the element in the beginning and delete_at_beg() to delete the element at the beginning of the linked list.

Python Program to create a Singly Linked List

Python program is given below to create a singly Linked List. This program contains two classes first is class Node and the second is class LinkedList, Both the classes are discussed below.

Node Class:
Each node object must hold at least two pieces of information. First the data item in the node and the second is reference to the next node. A refrence to None means here that there is no next node. Note in the constructor that a node is initially created with next to None.

C Program to Find the Height Or Maximum Depth of a Binary tree

The height of a node is the length of the longest downward path to a leaf from that node. So, the height or maximum depth of the tree is height of its root node. Algorithm and c program to find the maximum depth or height of a binary tree is given below.

                                                 /  \
                                               /      \