
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 33676 Articles for Programming

704 Views
As we know that the queue data structure is First in First Out data structure. The queue has some variations also. These are the Dequeue and the Priority Queue.Here we will see one variation of queue, that is the priority queue. In this structure, each element in the queue has its own priority. When we insert item into queue, we have to assign priority value with it. It will delete the highest priority element at first. To implement priority queue one of the easiest method is using the heap data structure.Let us see one C++ code for priority queue STL. ... Read More

5K+ Views
Here we will see the threaded binary tree data structure. We know that the binary tree nodes may have at most two children. But if they have only one children, or no children, the link part in the linked list representation remains null. Using threaded binary tree representation, we can reuse that empty links by making some threads.If one node has some vacant left or right child area, that will be used as thread. There are two types of threaded binary tree. The single threaded tree or fully threaded binary tree.For fully threaded binary tree, each node has five fields. ... Read More

2K+ Views
Circular Linked List is a variation of Linked list in which the first element points to the last element and the last element points to the first element. Both Singly Linked List and Doubly Linked List can be made into a circular linked list.In doubly linked list, the next pointer of the last node points to the first node and the previous pointer of the first node points to the last node making the circular in both directions.As per the above illustration, following are the important points to be considered.The last link's next points to the first link of the ... Read More

639 Views
Here we will see some basic concepts of the sorted arrays. The arrays are homogeneous data structure to hold same kind of data in some consecutive memory locations. Sometimes we need to sort the elements to use them. Other than that we can make a sorted array. That will always be sorted.In this case we will see the algorithms for insert and delete into sorted array. If we insert some element in it, it will automatically be placed at sorted position. So we do not need to sort it again after insertion. When we delete, it will delete the element, ... Read More

2K+ Views
As we know that the queue data structure is First in First Out data structure. The queue has some variations also. These are the Dequeue and the Priority Queue.The Dequeue is basically double ended queue. So there are two front and two rear pairs. One pair of front and rear pointer is used to describe the queue from left side, and another one is used to describe it from the right side. We can insert or delete elements from both side in this structure. Here we will see some C++ code using dequeue STL to understand its functionality.Example (Dequeue) Live Demo#include ... Read More

2K+ Views
A queue is an abstract data structure that contains a collection of elements. Queue implements the FIFO mechanism i.e the element that is inserted first is also deleted first.Queue cane be one linear data structure. But it may create some problem if we implement queue using array. Sometimes by using some consecutive insert and delete operation, the front and rear position will change. In that moment, it will look like the queue has no space to insert elements into it. Even if there are some free spaces, that will not be used due to some logical problems. To overcome this ... Read More

966 Views
Both Last() and LastOrDefault() will fetch the last occurrence of a value. But the major difference between Last() and LastOrDefault() is that Last() will throw an exception if there is no result data for the supplied criteria whereas LastOrDefault() will return the default value (null) if there is no result data.Use Last() when we knew the sequence will have at least one element. Use LastOrDefault() when we are not sure about the data.Example Live Demousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace ConsoleApp { public class Student { public int Id { get; set; } ... Read More

3K+ Views
Yield keyword helps to do custom stateful iteration over a collection. Meaning when we use yield keyword the control moves back and forth from the caller function to source and vice versa.Example Live Demousing System; using System.Collections.Generic; namespace DemoApplication { class Program { static List numbersList = new List { 1, 2, 3, 4, 5 }; public static void Main() { foreach(int i in RunningTotal()) { Console.WriteLine(i); } Console.ReadLine(); ... Read More

2K+ Views
Generics allows us to define a class with placeholders for the type of its fields, methods, parameters, etc. Generics replace these placeholders with some specific type at compile time. A generic can be defined using angle brackets . A primary limitation of collections is the absence of effective type checking. This means that you can put any object in a collection because all classes in the C# programming language extend from the object base class.Also, we cannot simply return null from a generic method like in normal method. Below is the error that a generic method will throw if we ... Read More

2K+ Views
While copying the entire contents of directory, it is more important that we have copy its sub directories and the related files.ExampleLet us consider demo source directory having sub directories and files like below. Below is the demo target directory which is empty initially.using System; using System.IO; namespace DemoApplication { class Program { public static void Main() { string sourceDirectory = @"d:\DemoSourceDirectory"; string targetDirectory = @"d:\DemoTargetDirectory"; DirectoryInfo sourceDircetory = new DirectoryInfo(sourceDirectory); DirectoryInfo targetDircetory = new DirectoryInfo(targetDirectory); CopyAll(sourceDircetory, ... Read More