# Basic CS-Data Structures [TCS Placement]: Sample Questions 18 - 19 of 28

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

## Question 18

Data Structures
Edit

### Describe in Detail

Essay▾

Whether linked list is linear or non-linear data structure?

### Explanation

• According to access strategies, linked list is a linear data structure.
• The data structure where data items are organized sequentially or linearly one after another is called linear data structure.
• Data elements in a liner data structure can be traversed one after the other and only one element can be directly reached while traversing. All the data items in linear data structure can be traversed in single run.
• Example: Arrays, stacks, Queue and Linked List
• According to storage, linked list is a non-linear data structure while array is the linear one.
• The data structure where data items are not organized sequentially is called non-linear data structure.
• Data elements of the non-linear data structure could be connected to more than one elements to reflect a special relationship among them.
• All the data elements in non linear data structure cannot be traversed in single run.
• Example: Trees and Graphs

## Question 19

Data Structures
Edit

### Describe in Detail

Essay▾

What is hash table?

### Explanation

• A hash table (hash map) is a data structure, which implements an associative array abstract data type- mapping keys to values.
• A hash table uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.
• In hashing, large keys are converted into small keys by using hash functions. The values are then stored in a data structure called hash table.
• For example:
• To enter a name in to the hash table we found out the hash value by applying a suitable hash function.
• The hash function maps the name into an integer between zero and k-1 this value is used as an index in the hash table.

Developed by: