- 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 348 Articles for Data Structure Algorithms

Updated on 22-Feb-2023 11:25:00
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 
Updated on 28-Dec-2022 10:27:12
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 
Updated on 16-Jun-2021 14:17:21
Linear Bounded Automaton (LBA) is a restricted form of Turing Machine in which input tape is finite.ExampleProve that LBA ⊂ PSPACEPSPACE is a superset of the set of context-sensitive languages.Now to prove LBA=PSPACE, We use theorem of Space compression with tape reduction which states that, For every k-tape S(n) space-bounded off-line Turing Machine M and constant c>0, there exists a one-tape cS(n) space-bounded off-line turing machine N such that L(M)=L(N).Following identity holds for −DSPACE(S(n))=DSPACE(O(S(n)))and NSPACE(S(n))=NSPACE(O(S(n)))Since LBA is one-tape n space-bounded Turing Machine it follows −LBA=NSPACE(n)---------------------(1)Now by Savitch theorem, if S is fully space constructible and S(n)>log(n) thenNSPACE(S(n)) ⊆DSPACE(S^{2}(n)) -------------(2)Final proofLBA=NSPACE(n)............by(1)⊆DSPACE(n^{2})............by(2)⊂DSPACE(n^{3})............by ... Read More 
Updated on 16-Jun-2021 14:16:09
Push down Automata (PDA) is complement of the PDA that contain Substring bbbStepsMake the PDA for accepting those strings that have conation bbb.Complement it by making non-accepting as accepting and vice versa.Construct PDAYou can construct the PDA as shown below for the (a, b)* languageThe nature of transition format is Input, Top of stack, PUSH/POPExamplea ,a , aa means on i/p a and top of stack is a then push aAt q0 i, e initial if a or b anything came move state to q1Till q1 we get 1 b to make substring b_ _ so now on q1 if ... Read More 
Updated on 16-Jun-2021 14:12:35
Let us begin by understanding the concept of deterministic finite automata (DFA) in the theory of computation (TOC).Deterministic Finite Automaton (DFA)In DFA, for each info image, one can decide the state to which the machine will move. Henceforth, it is called Deterministic Automaton.Formal Definition − A Deterministic Finite automata is a 5-tuplesM=(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.Non-deterministic finite automata (NDFA)In NDFA, for a specific info image, ... Read More 
Updated on 16-Jun-2021 14:07:16
A Turing machine (TM) is a 7-tuple (Q, ∑, Γ, δ, q0, qaccept , qreject).Where, Q is a finite set of states.∑ is the input alphabet that does not contain the blank symbol t.Γ is the tape alphabet, where t ∈ Γ and ∑ ⊆ Γ.δ: (Q × Γ) → (Q × Γ × {L, R}) is the transition function.q0 ∈ Q is the start state.qaccept ∈ Q is the accept state.qreject ∈ Q is the reject state, where qreject ≠ qaccept.For accepting even-length palindrome over the alphabet {0, 1}, follow the steps given below −Match the first and last ... Read More 
Updated on 16-Jun-2021 14:04:10
ProblemDesign a TM (Turing Machine) that takes a binary number as an input and replaces the last digit of the string with its Boolean complement.SolutionA Turing machine is a 7-tuple (Q, ∑, Γ, δ, q0, qaccept , qreject)Where, Q is a finite set of states.∑ is the input alphabet that does not contain the blank symbol t.Γ is the tape alphabet, where t ∈ Γ and ∑ ⊆ Γ.δ − (Q × Γ) → (Q × Γ × {L, R}) is the transition function.q0 ∈ Q is the start state.qaccept ∈ Q is the accept state.qreject ∈ Q is the ... Read More 
Updated on 16-Jun-2021 14:03:48
CFL refers to Context Free Language in the theory of computation (TOC). Let us now understand how CFL is closed under Union.CFL is closed under UNIONIf L1 and L2 are CFL’s then L1 U L2 is also CFL.Let L1 and L2 are generated by the Context Free Grammar (CFG).G1=(V1, T1, P1, S1) and G2=(V2, T2, P2, S2) without loss of generality subscript each non terminal of G1 and a1 and each non terminal of G2 with a2 (so that V1∩V2=φ).Subsequent steps are used production entirely from G1 or from G2.Each word generated thus is either a word in L1 or ... Read More 
Updated on 16-Jun-2021 14:03:14
A Recursively enumerable language is the language that accepts every string otherwise not. If a language that halt on every string, then we call it as recursive language.ProblemWe need to prove that the set of all languages that are not recursively enumerable on {a} is not countable.First let see what the recursive enumerable language is −Recursive Enumerable LanguageA language L is recursively enumerable if L is the set of strings accepted by some TM.If L is a recursive enumerable language then −if w ∈ L then a TM halts in a final state, if w ∉ L then a TM ... Read More 
Updated on 16-Jun-2021 14:02:46
ProblemWe have to prove that the cartesian product of a finite number of countable sets is countable.SolutionLet the X1, X2 ,…….. Xn be the countable sets.Yk= X1 * X2 * …….* Xk when k =1……. N). Thus, Yn := X1 * X2 * · · · * XnProofUsing the induction −In case k = 1 then Y1 = X1 is countable.Assuming that Yk (k ∈ n, 1 ≤ k < n) is countable;Then Yk+1 = ( X1 * X2 * …….* Xk) * Xk+1 = Yk * Xk+1 where the Yk and the Xk+1 can be called countable. Hence the ... Read More Advertisements