menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

Programming News

source image

Prodevelopertutorial

2w

read

47

img
dot

Check if given Binary Tree is BST

  • The binary tree is a BST

Read Full Article

like

2 Likes

source image

Prodevelopertutorial

2w

read

38

img
dot

Find Parent of a given node value in Binary Tree

  • Given a binary tree node and root node, get the parent node of that node.
  • The solution checks if the children nodes equal the given value.
  • If a match is found, the corresponding parent node is returned.
  • The process is done recursively on the left and right child nodes.

Read Full Article

like

2 Likes

source image

Prodevelopertutorial

2w

read

137

img
dot

Check if all Leaf Nodes are at same level in Binary tree

  • To check if all the leaf nodes are at the same level in a binary tree, we can use a pre-order traversal approach.
  • Start by visiting the left leaf and update the level value.
  • Then, check the right leaf and compare the level values.
  • If both levels are the same, return true; otherwise, return false.

Read Full Article

like

8 Likes

source image

Prodevelopertutorial

2w

read

146

img
dot

Image Credit: Prodevelopertutorial

Perform PreOrder traversal on a Binary Tree by without Recursion

  • Perform PreOrder traversal on a Binary Tree without using recursion
  • PreOrder traversal visits the root node, followed by the left child, and then the right child
  • A stack is used to implement the PreOrder traversal without recursion
  • The algorithm starts by pushing the root node into the stack and prints its value

Read Full Article

like

8 Likes

source image

Prodevelopertutorial

2w

read

77

img
dot

Image Credit: Prodevelopertutorial

Display Reverse Level Order Traversal by using queue

  • To display nodes in reverse level order traversal, we use a stack and a queue.
  • First, we enqueue the root node into the queue.
  • While the queue is not empty, we dequeue a node, push it into the stack, and enqueue its right and left child nodes.
  • Finally, we print the contents of the stack.

Read Full Article

like

4 Likes

source image

Prodevelopertutorial

2w

read

349

img
dot

Image Credit: Prodevelopertutorial

Display nodes at given level in Binary Tree

  • Given a binary tree root node and a level, display all the nodes present in that level.
  • Example:
  • Nodes at level 1 are : 16
  • Nodes at level 2 are : 10, 25
  • Nodes at level 3 are : 7, 15, 18, 30
  • Solution: This problem can be solved by recursive traversal.
  • If the level is 1, print the node value.
  • Recursively call the function for the left and right nodes with level reduced by 1.
  • C++ code example provided to demonstrate the solution.
  • Output: Nodes at level 2 are 10, 25

Read Full Article

like

21 Likes

source image

Prodevelopertutorial

2w

read

388

img
dot

Image Credit: Prodevelopertutorial

Get Number of Nodes in a Binary Tree

  • Given a binary tree, get the total number of nodes in it.
  • The total number of nodes in the given binary tree is 7.
  • This problem can be solved by recursive traversal.
  • We call 'get_num_of_nodes' recursively for left and right nodes to calculate the solution.

Read Full Article

like

23 Likes

source image

Prodevelopertutorial

2w

read

362

img
dot

Image Credit: Prodevelopertutorial

Get difference between values at Even and Odd level in a binary tree

  • Given a binary tree, we need to find the difference between the sum of the nodes at odd levels and the sum of the nodes at even levels.
  • The problem can be solved using recursive traversal.
  • We calculate the sum of nodes at odd levels and even levels separately by traversing the tree recursively.
  • Finally, we return the difference between the sum of nodes at odd levels and the sum of nodes at even levels.

Read Full Article

like

21 Likes

source image

Medium

2w

read

159

img
dot

No route found for “POST /login” (from “http://xx.net/authentication/signin”)

  • We have two distinct applications: an Angular application responsible for the user interface and a Symfony application handling the backend logic and data.
  • Apache2 acts as an intermediary, routing requests to the appropriate application based on the URL. This improves security and simplifies URL management for the frontend.
  • The virtual host configuration in Apache2 allows for intelligent routing of requests to the Angular and Symfony applications based on the URL path.
  • Ensure correct configurations, PHP handler, environment variables, and use of error logs when setting up the reverse proxy in Apache2 for Angular and Symfony applications.

Read Full Article

like

9 Likes

source image

Medium

2w

read

362

img
dot

Image Credit: Medium

The Phenomenon of KGF: A Game-Changer in Indian Cinema

  • The KGF franchise has become a game-changer in Indian cinema, setting new benchmarks for storytelling, action, and cinematic scale.
  • The franchise consists of two parts: KGF: Chapter One in 2018 and KGF: Chapter Two in 2022, both receiving critical acclaim and commercial success.
  • The plot is set in the backdrop of the Kolar Amber Fields in Karnataka and follows the journey of Rocky, played by Yash, who rises from poverty to gain control over the lucrative mines.
  • KGF combines mass appeal with a layered narrative, exploring themes of revenge, power, and redemption. The film's intense action sequences, powerful dialogues, and emotionally charged moments have resonated with audiences across languages and cultures.

Read Full Article

like

21 Likes

source image

Medium

2w

read

211

img
dot

Everything You Need to Know About Baby Pampers

  • Pampers are disposable diapers designed to provide complete protection to babies from newborn to toddlers.
  • Features of Baby Pampers include superior absorbency, soft and skin-friendly materials, and a comfortable fit.
  • Pampers use advanced absorbent technology to keep babies dry for hours, ensuring uninterrupted sleep.
  • Made from hypoallergenic materials, Pampers minimize the risk of diaper rash and promote healthy baby skin.

Read Full Article

like

12 Likes

source image

Medium

2w

read

38

img
dot

Image Credit: Medium

We Shouldn’t Call Them “Best Practices” — And Blindly Follow Them

  • Preaching and blindly following 'best practices' in coding may not always be the right approach.
  • Best practices often lack context and may not be suitable for every situation.
  • Migrating legacy applications and bringing their owners up to speed pose unique challenges.
  • Instead of strictly adhering to best practices, it is sometimes better to focus on doing the simplest thing that works.

Read Full Article

like

2 Likes

source image

Prodevelopertutorial

2w

read

155

img
dot

Given an array, that has zero. Move all the zero at the end, but maintain the relative order of other elements.

  • To move all the zeros at the end while maintaining the relative order of other elements, a simple solution is to use two loops.
  • In the first loop, iterate through the array and shift all the elements that are not equal to zero to the beginning of the array.
  • In the second loop, fill the remaining positions with zeros to move them to the end of the array.
  • The time complexity of this solution is O(n), where n is the size of the array.

Read Full Article

like

9 Likes

source image

Prodevelopertutorial

2w

read

211

img
dot

Given a linked list, check if it is a palindrome or not. Solution in C++

  • To check if a linked list is a palindrome, the linked list is divided into two halves.
  • The first half is left as it is, and the second half is reversed.
  • Then, the values of the corresponding nodes in both halves are compared.
  • If values don't match for any pair, the linked list is not a palindrome.

Read Full Article

like

12 Likes

source image

Prodevelopertutorial

2w

read

396

img
dot

C++ program to implement queue using stacks.

  • To implement a queue using stacks in C++, we create two stack variables: input_stack and output_stack.
  • The my_push(n) function inserts an element 'n' at the end of the queue by pushing it onto the input_stack.
  • The my_pop() function removes the element from the front of the queue by first calling my_peek() and then popping the element from the output_stack.
  • The my_peek() function returns the front element of the queue by moving the elements from the input_stack to the output_stack if the output_stack is empty.

Read Full Article

like

23 Likes

For uninterrupted reading, download the app