Group Discounts available for 3+ students and Corporate Clients

Data Structures Interview Questions

Data Structures Interview Questions And Answers

What is data structure?

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.

Define variable ?

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.

Which Data Structure Should be used for implementiong LRU cache?

  • Queue which 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 rear end.
  • A Hash with page number as key and address of the corresponding queue node as value.

How to implement a stack using queue?

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)

How is an Array different from Linked List?

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.

What are linear and non-linear data structures?

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.

What is the difference between a data type and data structure?

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.

What are data structure operations?

  • Traversing
  • Insertion
  • Searching
  • Deletion

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Data Structures Interview Questions"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Support


    Please Enter Your Details and Query.
    Three + 6