Server Side Programming Articles

Page 395 of 2109

Python Program to Count Number of Non Leaf Nodes of a given Tree

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 279 Views

When it is required to find the count of the non-leaf nodes in a Tree, a Tree_structure class is created with methods to set a root value, add nodes, and count non-leaf nodes. A non-leaf node is any node that has at least one child. Below is a demonstration of the same − What are Non-Leaf Nodes? In a tree data structure: Leaf nodes − nodes with no children Non-leaf nodes − nodes that have at least one child (also called internal nodes) 34 Non-leaf ...

Read More

Python Program to Count Number of Leaf Node in a Tree

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 721 Views

A leaf node in a tree is a node that has no children. In this program, we'll create a tree structure and implement a method to count all leaf nodes using recursive traversal. Understanding Leaf Nodes A leaf node is identified by having an empty children list. We'll use a helper function to recursively traverse the tree and collect all leaf nodes ? Tree Structure Implementation class Tree_structure: def __init__(self, data=None): self.key = data self.children ...

Read More

How to use Boto3 to get the list of triggers present in an AWS account

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 509 Views

In this article, we will see how to use Boto3 to get the list of all triggers present in an AWS Glue Data Catalog. AWS Glue triggers are used to start jobs or crawlers based on schedules or events. Prerequisites Before running this code, ensure you have: AWS credentials configured (via AWS CLI, IAM role, or environment variables) Boto3 library installed: pip install boto3 Appropriate IAM permissions for AWS Glue operations Approach The solution involves these key steps: Step 1: Import boto3 and botocore exceptions to handle errors Step 2: Create ...

Read More

How to use Boto3 to get the list of schemas present in AWS account

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 438 Views

In this article, we will see how a user can get the list of all schemas present in an AWS account using the Boto3 library. AWS Glue Data Catalog stores schema information that can be retrieved programmatically. Problem Statement Use boto3 library in Python to get the list of all schemas available in an AWS Glue Data Catalog. Prerequisites Before running the code, ensure you have: AWS credentials configured (via AWS CLI, IAM roles, or environment variables) Boto3 library installed: pip install boto3 Appropriate IAM ...

Read More

How to get the list of all registries present in an AWS account using Boto3

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 204 Views

In this article, we will see how a user can get the list of all registries present in an AWS account using the boto3 library in Python. What are AWS Glue Registries? AWS Glue registries are containers for schema versions in the AWS Glue Schema Registry. They help organize and manage schemas for data serialization and deserialization across different services. Prerequisites AWS credentials configured (AWS CLI, environment variables, or IAM roles) boto3 library installed: pip install boto3 Appropriate IAM permissions for AWS Glue operations Approach to List Registries Step 1: Import ...

Read More

How to get the list of all crawlers present in an AWS account using Boto3

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 548 Views

In this article, we will see how to get the list of all crawlers present in an AWS account using the boto3 library in Python. What are AWS Glue Crawlers? AWS Glue crawlers are programs that connect to data stores, determine data schemas, and populate the AWS Glue Data Catalog with table definitions. The list_crawlers() method helps retrieve all crawler names from your AWS Glue service. Prerequisites Before running the code, ensure you have: AWS credentials configured (via AWS CLI, IAM role, or environment variables) boto3 library installed: pip install boto3 Appropriate permissions to ...

Read More

How to get the details of a workflow using Boto3

Ashish Anand
Ashish Anand
Updated on 25-Mar-2026 432 Views

In this article, we will see how to retrieve the resource metadata of an AWS Glue workflow using Boto3. AWS Glue workflows organize and coordinate multiple jobs, crawlers, and triggers into a single unit. What is AWS Glue Workflow? An AWS Glue workflow is a collection of related jobs, crawlers, and triggers that work together to complete an ETL process. You can visualize and track the progress of the entire workflow through the AWS Glue console. Approach to Get Workflow Details Step 1: Import boto3 and botocore exceptions to handle errors. Step 2: The workflow_name ...

Read More

Python Program to Implement Queues using Stacks

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 456 Views

When it is required to implement a queue using stacks, we can create a queue class that uses two stack instances. This approach leverages the LIFO (Last In First Out) nature of stacks to achieve FIFO (First In First Out) behavior of queues. A queue has two main operations: enqueue (add element) and dequeue (remove element). We'll use two stacks − one for input operations and another for output operations. How It Works The algorithm uses two stacks: Input Stack: Handles all enqueue operations Output Stack: Handles all dequeue operations When dequeuing, if output stack ...

Read More

Python Program to Implement Stack Using Two Queues

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 637 Views

A stack follows Last-In-First-Out (LIFO) principle, while a queue follows First-In-First-Out (FIFO). This tutorial shows how to implement a stack using two queues, demonstrating an interesting data structure transformation. Stack and Queue Classes We need two classes: one for queue operations and another for stack implementation using two queues ? class Queue_structure: def __init__(self): self.items = [] self.size = 0 def check_empty(self): ...

Read More

Python Program to Reverse a Stack using Recursion

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 724 Views

A stack is a Last-In-First-Out (LIFO) data structure. To reverse a stack using recursion, we need two key functions: one to reverse the stack and another to insert elements at the bottom of the stack. Stack Implementation First, let's create a stack class with basic operations ? class Stack: def __init__(self): self.items = [] def is_empty(self): return len(self.items) == 0 ...

Read More
Showing 3941–3950 of 21,090 articles
« Prev 1 393 394 395 396 397 2109 Next »
Advertisements