Programming Articles

Page 1793 of 2547

Boundary Extraction of Image using MATLAB

Manish Kumar Saini
Manish Kumar Saini
Updated on 07-Aug-2023 2K+ Views

In an image, a boundary is an element that separates an object from the background of the image or two different regions within an image. Boundary provides information about the shape and structure of objects present in the image. Boundaries are mainly classified into the following two types: Inner Boundary It is the boundary of an object within an image that separates it from the image background. The inner boundary is basically the outline of the object and provides information about the shape of the object. Therefore, by extracting the inner boundary of an object, we can identify and analyze ...

Read More

Black and White Optical Illusion in MATLAB

Manish Kumar Saini
Manish Kumar Saini
Updated on 07-Aug-2023 288 Views

An optical or visual phenomenon that creates the perception of distortion, movement or any other type of fascinating visual effect by using back and white patterns is referred to as back and white optical illusion. These back and white patterns utilize the way our eyes and brain process the visual information and create an illusion to mislead our perception. The back and white optical illusions use various black and white patterns, shapes, and lines arranged in a specific style. These arrangements are made such that they can create illusion of movement, distortion, depth, and more. In this article, we will ...

Read More

Golang program that takes in a list of weights and values for items and a maximum weight capacity for knapsack

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 393 Views

In this Go language article, we will write programs that take in list of weights and values for items and a maximum weight capacity for knapsack. Knapsack problem is an optimization problem that uses dynamic programming. Here, the purpose is to find out the set of items that can be included in the knapsack without exceeding its weight capacity or maximum weight. Dynamic programming involves solving of problems by breaking them down into smaller subproblems and them combining them to get an optimal solution. Syntax func make ([] type, size, capacity) The make function in go language ...

Read More

Golang program that takes in a slice of integers and an anonymous function that filters each element in the slice

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 345 Views

In this Go language article, we will write programs that take in a slice of integers and an anonymous function that filters each element in the slice. An anonymous function is the function which uses no function name and is called by the variable which is assigned to it. It is used generally used with event listeners. Here, Filter function will be created with the anonymous functions to filter the values from slice. 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 ...

Read More

Golang program to print the numbers 1 to 100 concurrently, with each number printed by a separate goroutine

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 1K+ Views

In this article, we will write a Go language program to print the numbers from 1 to 100 concurrently with each number printed by a separate go routine. Concurrency means execution of multiple tasks parallelly and independently and making sure all the resources of the system are utilized. It can be achieved via go routines which are light weight threads and the channels. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments. Algorithm ...

Read More

Golang program to take in a slice of integers and compute their sum using concurrency

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 1K+ Views

In this Go language article, we will write programs to take in a slice of integers and compute their sum using concurrency. Concurrency helps multiple tasks or operations to be performed simultaneously. It helps make efficient use of system resources. It is achieved using Go routines which are light-weight threads and channels which helps in the communication between the go routines. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments. func range(variable) The ...

Read More

Golang program to sort a slice of integers using merge sort with concurrency

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 397 Views

In this article, we will write Go language programs to sort a slice of integers using merge sort with concurrency. It is a process which makes the parts of a program run independently and parallelly enhancing the efficiency of the program. Go routines and channels are used to execute concurrency. Merge sort is a divide and conquer algorithm used to sort the unsorted array or slice by dividing the input slice into smaller sub-slices, individually sort them recursively and then merge them into a single slice which is sorted. Syntax func make ([] type, size, capacity) The make function ...

Read More

Golang program to compute the factorial of a number using concurrency

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 632 Views

In this article, we will write Go language programs to compute the factorial of a number using concurrency. It is a task of implementing multiple operations simultaneously and can be implemented using Go routines and channels. Go routines are the lightweight threads and channels help in non-conflicting communications between the routines. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments. Algorithm This program imports the necessary packages main and fmt. In this ...

Read More

Golang program to compute all prime numbers up to a given number using concurrency

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 654 Views

In this Go language article, we will write programs to compute all prime numbers up to a given number using concurrent execution. Concurrent execution is the process of executing multiple tasks simultaneously. In Golang, go routines and channels are used to create concurrent programs. Go routines are lightweight threads which are managed by the Go runtime and channels help in the communication between Go routines without any conflicts. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size ...

Read More

Golang program to return the nth number in fibonacci sequence using dynamic programming

Akhil Sharma
Akhil Sharma
Updated on 04-Aug-2023 2K+ Views

In this article, we will write Go language programs to return the nth number in Fibonacci sequence using dynamic programming. It is a technique used to solve complex problems by breaking them into smaller sub problems. Memoization is the process of storing the output of the function calls in some data structure by which the next time call is made it need not calculate the output again, it can use that value to make the computation which in return lessens the execution time. Syntax func make ([] type, size, capacity) The make function in go language is used to ...

Read More
Showing 17921–17930 of 25,466 articles
Advertisements