- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 34484 Articles for Programming
161 Views
Throughout this article, we will dive into the details of implementing the PrintPerson function, understanding the structure of a Person, and executing the program to obtain the desired output. So, let's get started and learn how to utilize Go's features to print person details effectively. In this article, we will explore how to create a Go program that features a function called PrintPerson. Here we are going to use two different methods: using printin function and using printf function along with examples to elaborate the concept. Syntax printperson(person) This represents a function called printperson, and the person is an ... Read More
391 Views
Multithreading is a feature of the Java programming language that allows us to perform multiple operations simultaneously. In it, the operation gets divided into multiple smaller parts called a thread. Each thread performs one independent task without affecting the other thread's performance. The main benefit of multithreading is the optimal use of resources like CPU and it boosts the execution time of allocated operations. Finding prime and palindrome numbers are two of the basic programming task that every beginner programmer perfroms. However, in this article, we are going to do the same task in an exciting way. We will ... Read More
138 Views
In this go-language article, we are going to create an interface named Reader that defines the read method using direct interface implementation, and interface Composition along with examples to elaborate on the concept. A read method in go language is used to read the data from a source. Syntax sw.data It represents accessing the data of a struct. sw − it represents a variable, it can be a user defined struct variable or a pointer to struct. data − it is the name of the field you want to access. copy(p, sw.data[sw.pos:]) used to copy data ... Read More
758 Views
Memory management is an important aspect of any Java application. Having the knowledge of how much memory is available, how much is used and how much is free may help you to optimize your code and avoid performance issues or memory leaks. This article aims to help in finding max memory, free memory and total memory that are a crucial part of Java Heap. Note that the amount of memory allocated to a Java program depends on the environment. Java Program to find Max Memory, Free Memory and Total Memory Java provides the following methods and classes that ... Read More
77 Views
The work method in the go language is a user-defined method for custom data types to perform various operations. You can choose any name but functionality will depend on the specific requirement. The Worker interface can be executed by different sorts to supply distinctive usage of the Work behavior. Here we are going to use three different methods: direct interface implementation, struct embedding as well as interface assertion along with examples to elaborate the concept. In this article, we are going to investigate how to form an interface named Laborer in Go that indicates a Work strategy. Syntax type Animal ... Read More
132 Views
The speak method in golang is obtained by the customized functions that you can define to achieve a specific functionality. Speak is a user-defined function that performs the task for which it is created. In this article, we are going to create an animal interface that defines the speak method. This interface serves as a blueprint for any type that wants to be considered an animal and provides a contract for implementing the Speak behavior. Here we are going to use three different methods: direct interface implementation, struct embedding as well as interface assertion along with examples to elaborate the ... Read More
173 Views
In Go, channels are a capable highlight for concurrent programming, empowering communication and synchronization between goroutines. In this article, we are going to investigate how to form a channel of sort string in Go and utilize a goroutine to send messages to the channel at normal intervals of 2 seconds. We are going to give a step-by-step exhibit of the program, displaying the utilization of channels and goroutines. Syntax time.NewTicker(time.Second) The Syntax time.NewTicker(time.Second) is used to create a new Ticker value from the time package in Go. time.Sleep(duration) The Syntax time.Sleep(duration) is used to pause the execution of a ... Read More
225 Views
A binary tree is a tree having at most two children whereas a binary search tree is the tree in which the elements in the left side of the tree are less than the elements in the right side of the tree. In this article, we will write Go language programs to check if a binary tree is a binary search tree. Here we will use different examples to provide a better understanding of the concept. Algorithm Step 1 − Create a Node struct with three fields the data of the node of type int, Left and right subtree ... Read More
191 Views
A binary tree is a tree which has at most two children and height refers to the no. of levels in the tree. In this article, we will use two examples to find the height of a binary tree. In this Golang article we will write programs to print the height of a binary tree. Syntax func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array slice. It takes number of arguments. The first argument is the array to which we wish to add the values followed by the values to add. ... Read More
457 Views
In this article, we will write Go language programs to merge two sorted linked lists. A linked list is a set of two fields with the value that is the data and the next pointer which points to the next node in the list. A linked list is a dynamic data structure with two pointers head and tail, where head points to the first value and tail points to the last value. Here, we will use two examples to merge the sorted linked list. Demonstration This demonstration represents two sorted linked lists “LIST1” and “LIST2”. we need to merge these ... Read More