Posts

OPERATION ON LINKED LIST

Image
Basic Operations Following are the basic operations supported by a list. Insertion  − Adds an element at the beginning of the list. Deletion  − Deletes an element at the beginning of the list. Display  − Displays the complete list. Search  − Searches an element using the given key. Delete  − Deletes an element using the given key. Insertion Operation Adding a new node in linked list is a more than one step activity. We shall learn this with diagrams here. First, create a node using the same structure and find the location where it has to be inserted. Imagine that we are inserting a node  B  (NewNode), between  A  (LeftNode) and  C  (RightNode). Then point B.next to C − NewNode.next −> RightNode; It should look like this − Now, the next node at the left should point to the new node. LeftNode.next −> NewNode; This will put the new node in the middle of the two. The new list should look like ...

Analog Signal

Image
ANALOG SIGNAL ANALOG SIGNAL :- 1. An electrical impulse or an electromagnetic wave which travels a distance to convey a message, can be termed as a signal in communication system. 2. A continuous time varying which represents a time varying quantity can be termed as an Analog signal.Signals which are continuous in time and amplitude are called analog signal 3. An analog signal can take on any value in a specified range of value. As the wave moves from value A to B, it passes through and includes an infinite number of values analog its path. Advantages of analog signals :-   1. The main advantages is the fine definition of the analog signal which has the potential for an infinite amount of signal resolution. 2.  Compared to digital signal, analog signals are of higher density. 3. Analog signals are best suited for the transmission of the audio and video. Disadvantages of analog signal :- 1.  Most of the analog systems also suffer from ...

Introduction of queue

Image
What is a Queue Data Structure? Queue  is also an abstract data type or a linear data structure, just like  stack data structure , in which the first element is inserted from one end called the  REAR (also called  tail ), and the removal of existing element takes place from the other end called as  FRONT (also called  head ). This makes queue as  FIFO (First in First Out) data structure, which means that element inserted first will be removed first. Which is exactly how queue system works in real world. If you go to a ticket counter to buy movie tickets, and are first in the queue, then you will be the first one to get the tickets. Right? Same is the case with Queue data structure. Data inserted first, will leave the queue first. The process to add an element into queue is called  Enqueue  and the process of removal of an element from queue is called  Dequeue . Basic features of Queue Like stack, queue is also an ordered...

Introduction of stack.

Image
What is Stack Data Structure? Stack  is an abstract data type with a bounded(predefined) capacity. It is a simple data structure that allows adding and removing elements in a particular order. Every time an element is a, it goes on the  top  of the stack and the only element that can be removed is the element that is at the top of the stack, just like a pile of objects. Basic features of Stack Stack is an  ordered list  of  similar data type . Stack is a  LIFO (Last in First out) structure or we can say  FILO (First in Last out). push()  function is used to insert new elements into the Stack and  pop()  function is used to remove an element from the stack. Both insertion and removal are allowed at only one end of Stack called  Top . Stack is said to be in  Overflow  state when it is completely full and is said to be in  Underflow state if it is completely empty. Applications of Stack The simpl...

Concept of algorithms

Image
Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an algorithm can be implemented in more than one programming language. From the data structure point of view, following are some important categories of algorithms − Search  − Algorithm to search an item in a data structure. Sort  − Algorithm to sort items in a certain order. Insert  − Algorithm to insert item in a data structure. Update  − Algorithm to update an existing item in a data structure. Delete  − Algorithm to delete an existing item from a data structure. Characteristics of an Algorithm Not all procedures can be called an algorithm. An algorithm should have the following characteristics − Unambiguous  − Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be c...

Singly linked list

Image
Singly linked list or One way chain Singly linked list can be defined as the collection of ordered set of elements. The number of elements may vary according to need of the program. A node in the singly linked list consist of two parts: data part and link part. Data part of the node stores actual information that is to be represented by the node while the link part of the node stores the address of its immediate successor. One way chain or singly linked list can be traversed only in one direction. In other words, we can say that each node contains only next pointer, therefore we can not traverse the list in the reverse direction. Consider an example where the marks obtained by the student in three subjects are stored in a linked list as shown in the figure. In the above figure, the arrow represents the links. The data part of every node contains the marks obtained by the student in the different subject. The last node in the list is identified by the null pointer which is pr...

Difference between array and linked list

Image
Difference between Array and Linked List Both Linked List and Array are used to store linear data of similar type, but an array consumes contiguous memory locations allocated at compile time, i.e. at the time of declaration of array, while for a linked list, memory is assigned as and when data is added to it, which means at runtime. This is the basic and the most important difference between a linked list and an array. In the section below, we will discuss this in details along with highlighting other differences. Linked List vs. Array Array is a datatype which is widely implemented as a default type, in almost all the modern programming languages, and is used to store data of similar type. But there are many usecases, like the one where we don't know the quantity of data to be stored, for which advanced data structures are required, and one such data structure is  linked list . Let's understand how array is different from Linked list. ARRAY LINKED LIST Array ...