Blog

30 March, 2020

**Ans: **A data structure is the logical or mathematical arrangement of data in memory. It considers not only the physical layout of the data items in the memory but also the relationships between these data items and the operations that can be performed on these items.

**Ans: **A variable is defined as a meaningful name given to a data storage location in the computer memory. When using a variable, we actually refer to the address of the memory where the data is stored.

**Ans: **

- The queue is implemented using a doubly-linked list. The maximum size of the queue will be equal to the total number of frames available (cache size). The most recently used pages will be near front end and least recently pages will be near the rear end.
- A Hash with page number as key and address of the corresponding queue node as value.

**Ans: **A stack can be implemented using two queues. Let stack to be implemented be ‘s’ and queues used to implement be ‘q1’ and ‘q2’. Stack ‘s’ can be implemented in two ways:

- Method 1 (By making push operation costly)
- Method 2 (By making pop operation costly)

**Ans: **

- The size of the arrays is fixed, Linked Lists are Dynamic in size.
- Inserting and deleting a new element in an array of elements is expensive, Whereas both insertion and deletion can easily be done in Linked Lists.
- Random access is not allowed in Linked Listed.
- Extra memory space for a pointer is required with each element of the Linked list.
- Arrays have better cache locality that can make a pretty big difference in performance.

**Ans: **A linear data structure involves the arrangement of values in a linearly. Some typical examples of a linear data structure are lists, queues, stacks, and arrays.

In a non-linear data structure, the elements are not stored in a sequence. Graphs and tree are some examples of a non-linear data structure.

**Ans: **In computing, a data type is a group of data values with characteristics that are already defined. Some data types are floats, characters, integer, and string. These are called primitive data types. A data structure, on the other hand, is a grouping of data for easy organization and accessibility. Tables, Array stacks, structs, queues, classes, files, and lists are some data structure.

**Ans: **

- Traversing
- Insertion
- Searching
- Deletion

**Ans: **The following are the operations that can be executed in data structures:

- Insertion: Insertion is a process where a new data element can be added to the data items collection.
- Deletion: Deletion is a process where a data element can be deleted from the data items collection.
- Traversal: Traversal id one of the basic operations within the data structure. Also, in this process, every data element can be accessed.
- Searching: Searching is a process where a data element can be searched within the collection of data elements. The data element should be present in the data collection.
- Sorting: Sorting is a process where the data elements can be arranged in an orderly fashion, i.e. ascending or descending order.

**Ans: **The Stack is nothing but a linear data structure where the data elements can be accessed. They are two ways to access the data elements,

- First in Last out (FILO)
- Last in First out (LIFO)

For Stack, the basic operations are listed below:

- Push
- Pop
- Peek

**Ans: **A queue is also a linear form of data structure where all the data elements are available in a systematic format. The data elements are available in First in First out form (FIFO).

The basic operation of the Queue are listed below:

- Enqueue
- Dequeue
- Front
- Rear

**Ans: **Both Queue and Stack are the same and follow a linear data structure model. The main difference between these two is the way a record is deleted/removed.

In a stack, the most recent data element that is added will be removed. Whereas, in Queue, the least recent data element that is added to the list will be deleted.

Queues and Stacks are created with the use of arrays and linked lists.

**Ans: **Below is the different types of Linked lists that are available.

- Singly Linked List
- Doubly Linked list
- Circular Linked list

**Ans: **The key difference between a storage structure and the file structure is the amount of memory that has been acquired.

The data structure that is stored in the main memory of the computer system is classified as a storage structure. This is an inbuilt storage system where the data is available.

On the other hand, if the data is residing on an extra/backup storage then it is classified as a File structure.

**Ans: **A Stack can be classified as an ordered list where all the operations like insertions/ deletions can be executed only from one end. The mentioned stack is nothing but a pure list of execution tasks, the order follows LIFO structure, i.e. Last-In-First-Out. So according to the LIFO structure, the line item that is entered into the stack will be executed at the end (concerning the priority).

**Ans: **The following are the list of operations that can be performed on Stack.

- Push operation:
- Peek operation
- Pop operation

**Ans: **The syntax of stack overflow condition is :

when top=maxsize-1

**Ans: **With the help of push and pop operations, the data can be effectively handled/managed within a stack. The main difference between push and pop operations is listed below:

Push operation:

Push operation is used when inserting the data into the Stack.

Pop Operation:

Pop operation is used when deleting the data from the Stack.

**Ans: **An array is nothing but a collection of data elements that are stored together in a memory location. Also, accessing the data elements within an array is very simple and every data element will have their index number. Using the index number the data element can be easily accessed.

**Ans: **A multi-dimensional array is nothing but an array of arrays. The data is stored or piled in the form of the tabular structure where it has rows and columns. The use of multi-dimensional arrays will help to store more amount of data in chunks.

**Ans: **A node contains two fields, they are :

- Data field
- Link field

**Ans: **A queue data structure is nothing but an ordered list that is piled up in the form of a stack. They are two ends to the queues where the operations can be taken into consideration:

Rear: All the data insertions are performed in Rear.

Front: All the data deletions are performed in Front.

**Ans: **Below is the few practical examples of data structure:

The daily usage of printers. All the print jobs at the printer follow a queue data structure. The same with all of your computing requests, CPU handles it well by a queuing mechanism

Data transfer activities via, sockets, pipes follow a queue data structure.

All the media songs that are piled up one after the other, i.e. playlists.

**Ans: **Dequeue is also known as a double-ended queue. It is exactly the opposite of a queue mechanism. In dequeue structure, all the data insertions and data deletion activities can be executed from both the sides, i.e. Front & Rear.

**Ans: **In general, to implement the priority queue, we need a bare minimum of at least two queues. One queue is essential to store all of the data elements together and another queue is needed to store the priority-based information.

**Ans: **They are 6 types of tree that are available. Below is the list:

- Binary search tree
- General tree
- Tournament tree
- Binary tree
- Forests
- Expression tree

**Ans: **A binary tree is a type of tree structure where each node has two children, i.e left child, and right child. Using this the tree structure can be progressed.

**Ans: **A queue data structure is the best data structure fit for tree construction.

**Ans: **A path is an orderly sequence of a continuous flow of vertices which are connected via their edges. Usually in this type of sequence, there are no restrictions observed.

**Ans: **A cycle is nothing but a closed path where the first vertice is the same as to that of the last/end vertex. Also, we get to see one condition here, the same vertex should not be passed twice.

**Ans: **A circuit is very similar to that of a cycle but the only difference is that the vertex can be passed n number of times and don't have any restrictions. Within the circuit, the first vertex is the same as that of the last vertex.

**Ans: **For the BFS algorithm, the queue data structure is useful.

**Ans: **For the DFS algorithm, the stack data structure is useful.

**Ans: **Linear search is also known as a sequential search. With this linear search approach, the search element is compared to every element in the list sequentially until a potential match is found.

**Ans: **A binary search is also called a half interval search or a binary chop. Within this search algorithm, the target value will be identified by comparing it to the array.

**Ans: **The advantages of selection sort are given below:

- It is easy to use
- Implementation wise it doesn't take much time
- Selection sort can be applied for smaller data sets
- it is efficient when compared to bubble sort

**Ans: **A NULL is a value that can be assigned to a data element. It represents that there is no data available for that particular data element.

**Ans: **VOID is a data type identifier.

It is used to identify pointers that don't have a size associated.

**Ans: **The main difference between a binary search and the linear search is the number of comparisons it does to the target value. In most of the cases, binary search is quick compared to the linear search.

**Ans: **An adjacency matrix is a data structure that is used for sequential representation.

**Ans: **An adjacency list is used for linked representation.

**Ans: **The tree data structure is applied in the following area:

- To understand the hierarchal data model
- Analysis of the syntax
- Symbol table construction process
- Arithmetic expressions and its manipulation.

**Ans: **Yes, the size of a linked list can be increased. The size is increased at the runtime.

**Ans: **No, the size of an array cannot be increased.

**Ans: **A linked list is considered as a linear data structure and a non-linear data structure. Based on the usage and the situation, the linked list can be aligned.

Based on data storage criteria, a linked list is considered as a non-linear data structure.

Based on the access strategy, a linked list is considered as a linear data structure.

**Ans: **The following are examples of multi-linked structures

- Generating index
- Sparse matrix

TekSlate

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .