Data Structures: Question Set – 03

Data Structures: Question Set – 03

How singly linked list works?

A data structure known as a singly linked list is one that can be employed for the purpose of storing several objects. By employing the key, the things are connected to one another. The key is an identifier that may be used to identify the item, and it is typically one that is only used once.

Each individual item in a singly linked list will be kept in its own distinct node. The node can either consist of a single object or a group of other things altogether. When a new item is added to the list, the node is updated, and the position of the new item in the list is moved to the end.

When an item is eliminated from the list, the node that was housing that eliminated item is removed from the tree structure and another node is substituted in its place.

The “key” of a single linked list can be any kind of data structure that can be employed in the process of determining the identity of an item. It could be an integer, a string, or even another singly linked list, for instance. Another possibility is that it is both.

The storage of many different kinds of data can be facilitated by using singly-linked lists. For instance, they are frequently utilised for the purpose of storing lists of goods, such as patient records and shopping lists. They are also helpful for storing data that is sensitive to the passage of time, such the values of stocks on the stock market or airline plans.

Explain the working of double linked list

A doubly linked list is a type of data structure that enables data access in both directions. This is accomplished by having each node in the list point not only to the node that comes after it but also to the node that came before it.

The contents of a node in a doubly linked list can be accessed by using the index, while the address of the node itself can be used to reach the node itself. Applications that require quick access to big amounts of data will find it to be an excellent choice for storage.

Maintaining a doubly linked list is more complex than maintaining a single-linked list, which is one of the disadvantages of a doubly linked list. It is also more difficult to add and remove nodes in a double-linked list than it is in a single-linked list.

How circular linked list works?

A circular linked list is a type of unidirectional linked list in which each node points to its next node and the last node points back to the first node, so making the list circular. Circular linked lists are also known as bidirectional linked lists.

What is a doubly circular linked list?

A doubly circular linked list is a type of linked list in which each node points to both its next node and its previous node, the last node points back to the first node, and the first node’s previous node points to the last node. Additionally, the first node’s previous node also points to the last node.

What is a header list?

The term “header-linked list” refers to a list that begins with the header node. This type of list can be identified by its name. Calculating some repetitive processes, such as the number of items in a list, for example, is made easier with the help of this.

Differentiate: Array vs. Linked list

ArraysLinked Lists
An array is a collection of data elements of the same type.A linked list is a collection of entities known as nodes. The node is divided into two sections: data and address.
It keeps the data elements in a single memory.It stores elements at random, or anywhere in the memory.
The memory size of an array is fixed and cannot be changed during runtime.The memory size of a linked list is allocated during runtime.
An array’s elements are not dependent on one another.Linked List elements are dependent on one another.
It is easier and faster to access an element in an array.In the linked list, it takes time to access an element.
Memory utilization is ineffective in the case of an array.Memory utilization is effective in the case of an array.
Operations like insertion and deletion take longer time in an array.Operations like insertion and deletion are faster in the linked list.

What exactly is meant by the term “asymptotic analysis” of an algorithm?

An asymptotic analysis of an algorithm defines the run-time performance of the algorithm according to the mathematical foundations of the algorithm. The performance of an algorithm can be broken down into three categories using asymptotic analysis: best case (represented by the omega symbol), average case (represented by the theta symbol), and worst case (represented by the big oh symbol).

In terms of data structure, what is a hashmap?

Hashmap is a data structure that employs an implementation of a hash table data structure, which, assuming you have the key, enables you to retrieve data with a complexity of O(1) rather than the more traditional constant time.