Posts

Application Linked list

Application of Linked List What is a linked List? A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. Applications - The use of Linked list is widespread in real life, but often goes unnoticed. Here are some of the uses of Linked lists – Computer application – Graph representation – Due to the dynamic nature of modern graph applications, the graphs can either be sparse or too dense. Thus, Adjacency list is used for these representations CPU scheduling – In the preemptive scheduling of processes, based on priorities in the wait queue the processes are scheduled in the ready queue. Some architectures implement using priority queues and some implement using linked lists. In computational Geometry and computer graphics, the polygons are represented using doubly circular linked lists. It helps in the triangulation of polygons, finding the Voronoi diagrams, etc. In Blockchain and Distributed Ledger Technologie...

C++ File Handling

Image
File Handling in C++ File are used to store the user data for extended time periods. As such the data is stored in permanent device storage. Thus, File handling becomes an essential mechanism to store the output of program or to receive inputs for a program and other various operations. To receive and send data to and from a device, stream is used as an abstraction. Stream is represented as source or destination of characters of indefinite length. In C++, file handling can be done using libraries, as such, ifstream, ofstream and fstream provide the needed functionality. These classes are derived from fstrembase and corresponding iostream class. Thus, any C++ program involving must include fstream library, as these classes are a part of the library. In C++, files are mainly dealt by using three classes fstream, ifstream, ofstream. ofstream: This Stream class signifies the output file stream and is applied to create files for writing information to files ifstream...

Operator Overloading in C++

Image
Operator Overloading What is an operator? Operators are symbolic representation of mathematical or logical operations that can be performed on one or more operands. In C++, there are following operators present: Operator Type Number of operands ++,-- Unary Operator 1 +,-,*,/,% Arithmetic operator 2 <,<=,>,>=,==,!= Relational operator 2 &&,||,! Logical operator 2 &,|,<<,>>,~,^ Bitwise operator 2 =,+=,-=,*=,/=,%= Assignment operator 2 ?: Ternary operator 3 There are some special operators such as . (dot operator), :: (Scope resolution) and sizeof operator. Each of them has a special purpose such as the dot operator is used for Member resolution, :: is used to change the resolution of a assignment or Member and sizeof is a C++ compiler unary operator which is used to determine the memory size of i...