
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
Found 26504 Articles for Server Side Programming

307 Views
ExampleSuppose we have the following binary tree.Postorder Tree Traversal Output − 2 4 5 3 6 7 1.Approach to solve this problemStep 1 − If the root node of the given tree is nil, then return; else, follow the steps given below.Step 2 − Traverse the Left sub-tree.Step 3 − Traverse the Right sub-tree.Step 4 − Print the root node data.Example Live Demopackage main import "fmt" type Node struct { data int left *Node right *Node } func (root *Node)PostOrderTraversal(){ if root !=nil{ root.left.PostOrderTraversal() root.right.PostOrderTraversal() fmt.Printf("%d ", root.data) ... Read More

90 Views
ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If index i matches with the given index (to be updated), then update that node.Step 6 − Else, return head.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = ... Read More

99 Views
ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If the index i matches with the given index (to be updated), then update that node.Step 6 − Else, return head.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next ... Read More

119 Views
ExampleApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If index i matches with the given index (to be updated), then update that node.Step 6 − Else, return head.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = ... Read More

113 Views
ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return the head.Step 3 − Initialize the index as i := 0.Step 4 − Iterate the given linked list from its head.Step 5 − If index i matches with given index (to be updated), then update that node.Step 6 − Else, return the head.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value int, next *Node) *Node{ var n Node n.value = value n.next = ... Read More

810 Views
In this program, we will calculate the rms (root mean square) of all the pixels in each channel using the Pillow library. There are a total three channels in an image and therefore, we will get a list of three values.Original ImageAlgorithmStep 1: Import the Image and ImageStat libraries. Step 2: Open the image. Step 3: Pass the image to the stat function of the imagestat class. Step 4: Print the root mean square of the pixels.Example Codefrom PIL import Image, ImageStat im = Image.open('image_test.jpg') stat = ImageStat.Stat(im) print(stat.rms)Output[104.86876722259062, 96.13661429330132, 91.8480515464677]

1K+ Views
In this program, we will calculate the variance of all the pixels in each channel using the Pillow library. There are a total three channels in an image and therefore, we will get a list of three values.Original ImageAlgorithmStep 1: Import the Image and ImageStat libraries. Step 2: Open the image. Step 3: Pass the image to the stat function of the imagestat class. Step 4: Print the variance of the pixels.Example Codefrom PIL import Image, ImageStat im = Image.open('image_test.jpg') stat = ImageStat.Stat(im) print(stat.var)Output[5221.066590958682, 4388.697801428673, 4291.257706548981]

1K+ Views
In this program, we will calculate the standard deviation of all the pixels in each channel using the Pillow library. There are total 3 channels in an image and therefore we will get a list of three values.Original ImageAlgorithmStep 1: Import Image and ImageStat libraries. Step 2: Open the image. Step 3: Pass the image to the stat function of the imagestat class. Step 4: Print the standard deviation of the pixels.Example Codefrom PIL import Image, ImageStat im = Image.open('image_test.jpg') stat = ImageStat.Stat(im) print(stat.stddev)Output[72.25694839223894, 66.24724750077299, 65.50769196475312]

302 Views
In this program, we will blur an image using a rank filter. The ImageFilter class in the pillow library contains a function called RankFilter() which helps to apply the rank filter. It takes two parameters, size of the kernel and rank. Rank is 0 for a min filter, size*size/2 for a median filter and size*size-1 for a max filter.Original ImageAlgorithmStep 1: Import Image and ImageFilter from Pillow. Step 2: Open the image. Step 3: Call the rankfilter() method and specify the size and rank. Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('image_test.jpg') im1 = ... Read More

420 Views
In this program, we will blur an image using a Box filter. The ImageFilter class in the pillow library contains a function called BoxBlur() which helps to apply the box blur filter. It takes only one parameter that is blur radius.Original ImageAlgorithmStep 1: Import Image and ImageFilter from Pillow. Step 2: Open the image. Step 3: Call the boxblur() method and specify the radius. Step 4: Display the output.Example Codefrom PIL import Image, ImageFilter im = Image.open('image_test.jpg') im1 = im.filter(ImageFilter.BoxBlur(radius = 7)) im1.show()Output