Data Structure Algorithms Articles

Page 2 of 24

Binomial Distribution in Data Structures

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 524 Views

The Binomial Distribution is a discrete probability distribution Pp(n | N) of obtaining n successes out of N Bernoulli trails (having two possible outcomes labeled by x = 0 and x = 1. The x = 1 is success, and x = 0 is failure. Success occurs with probability p, and failure occurs with probability q as q = 1 – p.) So the binomial distribution can be written as$$P_{p}\lgroup n\:\arrowvert\ N\rgroup=\left(\begin{array}{c}N\ n\end{array}\right) p^{n}\lgroup1-p\rgroup^{N-n}$$Example#include #include using namespace std; int main(){    const int nrolls = 10000; // number of rolls    const int nstars = 100; // maximum ...

Read More

Convex Hull Example in Data Structures

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 2K+ Views

Here we will see one example on convex hull. Suppose we have a set of points. We have to make a polygon by taking less amount of points, that will cover all given points. In this section we will see the Jarvis March algorithm to get the convex hull.Jarvis March algorithm is used to detect the corner points of a convex hull from a given set of data points.Starting from left most point of the data set, we keep the points in the convex hull by anti-clockwise rotation. From a current point, we can choose the next point by checking ...

Read More

Difference between Pushdown Automata and Finite Automata

Shirjeel Yunus
Shirjeel Yunus
Updated on 19-Aug-2024 3K+ Views

Automata is a theoretical concept which is taught in computer science and mathematics. The topics included in automata include abstract machines. These machines have to deal with computational problems and resolve them. Automata theory is used to develop methods which can be used in the description and analysis of the dynamic behavior of the discrete system. There are two types of automata which are Pushdown automata and finite automata. In this article, we will discuss the difference between Pushdown Automata and Finite Automata. What is Pushdown Automata? Pushdown automata is a finite state machine which also consists of additional stack ...

Read More

What is the difference between DFA and NFA?

Bhanu Priya
Bhanu Priya
Updated on 31-Oct-2023 73K+ Views

DFA is the short form for the deterministic finite automata and NFA is for the Non-deterministic finite automata. Now, let us understand in detail about these two finite automata.DFAA Deterministic Finite automata is a five-tuple automata. Following is the definition of DFA −M=(Q, Σ, δ, q0, F)Where, Q : Finite set called states.Σ : Finite set called alphabets.δ : Q × Σ → Q is the transition function.q0 ϵ Q is the start or initial state.F : Final or accept state.NFANFA also has five states same as DFA, but with different transition function, as shown follows −δ: Q X Σ ...

Read More

Implementing a Recommendation System

Sohail Tabrez
Sohail Tabrez
Updated on 13-Jul-2023 587 Views

Introduction A type of information filtering system called a recommendation system looks at user data to suggest things that might be of interest to them. It is generally utilized in different areas, like web-based business, virtual entertainment, and diversion. Data collection, data preprocessing, algorithm selection, and algorithm evaluation are just a few of the steps involved in putting a recommendation system into action. In this article, we will talk about these means exhaustively and give a few reasonable tips to building a viable proposal framework. The Recommendation System A Data Collection Collecting relevant data is the first step in building ...

Read More

Can we use Simple Queue instead of Priority queue to implement Dijkstra's Algorithm?

Sonal Meenu Singh
Sonal Meenu Singh
Updated on 22-Feb-2023 3K+ Views

Introduction Dijkstra’s Algorithm is used to find the shortest possible distance between two objects. To implement this algorithm we mostly use Priority Queue. In this tutorial, we will find the answer to whether can we use a simple queue to implement Dijkstra’s algorithm instead of a Priority Queue. What is a Priority Queue and A Queue? A queue is a linear array of data. It represents the Queue of real life. A simple Queue uses FIFO (First In First Out) approach for its deQueue and enQueue operations. A priority Queue is a type of Queue that deQueue its elements with ...

Read More

Difference Between Quick Sort and Merge Sort

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 21-Feb-2023 7K+ Views

The task of arranging the elements of an array in a particular order is referred to as sorting. The sorting of an array or a list is mainly done to make the searching easier. There are several types of sorting algorithms, but in this article, we will concentrate on quick sort and merge sort. Both quick sort and merge sort algorithms are based on the divide-and-conquer sorting algorithms, hence they work almost in a similar way. Read this article to learn more about quick sort and merge sort and how these sorting techniques are different from each other. What is ...

Read More

Difference Between Bubble Sort and Selection Sort

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 20-Feb-2023 15K+ Views

The task of arranging elements of an array in a particular order is referred to as sorting. The sorting of an array or a list is mainly done to make the searching easier. There are two types of sorting algorithms namely, Bubble Sort and Selection Sort. Bubble sort performs sorting of data by exchanging the elements, while the selection sort performs sorting of data by selecting the elements. Read this article to learn more about bubble sort and selection sort and how these two sorting techniques are different from each other. What is Bubble Sort? Bubble sort is a simple ...

Read More

Top 7 Clustering Algorithms Data Scientists Should Know?

Jay Singh
Jay Singh
Updated on 28-Dec-2022 604 Views

Clustering algorithms are a type of machine learning algorithm that can be used to find groups of similar data points in a dataset. These algorithms are useful for a variety of applications, such as data compression, anomaly detection, and topic modeling. In some cases, clustering algorithms can be used to find hidden patterns or relationships in a dataset that might not be immediately apparent. By grouping similar data points together, clustering algorithms can help to simplify and make sense of large and complex datasets. In this post, we will look closely at Clustering algorithms and the top seven algorithms that ...

Read More

Design a TM for an equal number of a's and b's must follow a

Bhanu Priya
Bhanu Priya
Updated on 10-Mar-2022 5K+ Views

The Turing machine (TM) is more powerful than both finite automata (FA) and pushdown automata (PDA). They are as powerful as any computer we have ever built.Formal Definition of Turing MachineA Turing machine can be formally described as seven tuples(Q, X, Σ, δ, q0, B, F)Where, Q is a finite set of statesX is the tape alphabetΣ is the input alphabetδ is a transition function: 𝛿:QxX→QxXx{left shift, right shift}q0 is the initial stateB is the blank symbolF is the final state.A Turing Machine (TM) is a mathematical model which consists of an infinite length tape divided into cells on which ...

Read More
Showing 11–20 of 234 articles
« Prev 1 2 3 4 5 24 Next »
Advertisements