freshers data structure interview questions

[quote]What is shell sort?[/quote]

Shell sort can be said a variant of insertion sort. Shell sort divides the list into smaller sublist based on some gap variable and then each sub-list is sorted using insertion sort. In best cases, it can perform up to Ο(n log n).

[quote]How depth-first traversal works?[/quote]

Depth First Search algorithm(DFS) traverses a graph in a depth ward motion and uses a stack to remember to get the next vertex to start a search when a dead end occurs in any iteration.

[quote]What is a binary search tree?[/quote]

A binary search tree is a binary tree with a special provision where a node’s left child must have value less than its parent’s value and node’s right child must have the value greater than it’s parent value.

[quote]How many stacks are required to implement a Queue?[/quote]

Two, Have two stacks S1 and S2.
For Enqueue, perform push on S1. For Dequeue, if S2 is empty pop all the elements from S1 and push it to S2. The last element you popped from S1 is an element to be dequeued. If S2 is not empty, then pop the top element in it.

[quote]What is a node?[/quote]

The data element of a linked list is called a node.

[quote]What is the Brute Force algorithm?[/quote]

The algorithm used to search the contents by comparing each element of an array is called Brute Force algorithm.

[quote]A stack can be described as a pointer explain this?[/quote]

Because stack will contain a head pointer which will always point to the top of the Stack. All Stack Operations are done using a head pointer. Hence stack can be described as a pointer

[quote]What do you mean by Syntax Error, Logical Error, Run time Error? [/quote]

[quote]What are the methods available in storing sequential files?[/quote]

Straight merging, Natural merging, Polyphase sort, Distribution of Initial runs.

[quote]What is the AVL tree?[/quote]

AVL tree is a self binary tree in which balancing factor lies between the -1 to 1. It is also known as a self-balancing tree.

data structure freshers interview questions

[quote]What is a binary tree?[/quote]

A binary tree is a tree which has maximum no. of children either 0 or 1 or 2. i.e., there is at the most 2 branches in every node.

[quote]What is an ordered list?[/quote]

An ordered list is a list in which each node’s position in the list is determined by the value of its key component, so that the key values form an increasing sequence, as the list is traversed.

A linear search refers to the way a target key is being searched in a sequential data structure. In this method, each element in the list is checked and compared against the target key. The process is repeated until found or if the end of the file has been reached.

[quote]How does variable declaration affect memory allocation?[/quote]

The amount of memory to be allocated or reserved would depend on the data type of the variable being declared. For example, if a variable is declared to be of integer type, then 32 bits of memory storage will be reserved for that variable.

[quote]What is the advantage of the heap over a stack?[/quote]

The heap is more flexible than the stack. That’s because memory space for the heap can be dynamically allocated and de-allocated as needed. However, the memory of the heap can at times be slower when compared to that stack.

data structure interview questions with answers

[quote]What is the difference between a stack and a Queue?[/quote]

[quote]What do you mean by overflow and underflow? [/quote]

When new data is to be inserted into the data structure but there is no available space i.e.free storage list is empty this situation is called overflow. When we want to delete data from a data structure that is empty this situation is called underflow.

[quote]What are the applications of a binary tree?[/quote]

A binary tree is used in data processing.

[quote]What is a string?[/quote]

A sequential array of characters is called a string.

[quote]Translate infix expression into its equivalent postfix expression: (A-B)*(D/E)[/quote]

(A-B)*(D/E) = [AB-]*[DE/] = AB-DE/*

[quote]What is the queue?[/quote]

A Queue is a sequential organization of data. A queue is a first in first out type of data structure. An element is inserted at the last position and an element is always taken out from the first position.

[quote]What are the types of Collision Resolution Techniques and the methods used in each of the types?[/quote]

[quote]How can you overcome the limitations of arrays?[/quote]

Limitations of arrays can be solved by using the linked list.

[quote]What are multidimensional arrays?[/quote]

Multidimensional arrays make use of multiple indexes to store data. It is useful when storing data that cannot be represented using single dimensional indexing, such as data representation in a board game, tables with data stored in more than one column.

[quote]Are linked lists considered linear or non-linear data structures?[/quote]

It depends on where you intend to apply linked lists. If you based it on storage, a linked list is considered non-linear. On the other hand, if you based it on access strategies, then a linked list is considered linear.

[quote]How does dynamic memory allocation help in managing data?[/quote]

Apart from being able to store simple structured data types, dynamic memory allocation can combine separately allocated structured blocks to form composite structures that expand and contract as needed.

[quote]What is merge sort?[/quote]

Merge sort, is a  divide-and-conquer approach for sorting the data. In a sequence of data, adjacent ones are merged and sorted to create bigger sorted lists. These sorted lists are then merged again to form an even bigger sorted list, which continues until you have one single sorted list.

[quote]What is the primary advantage of a linked list?[/quote]

A linked list is an ideal data structure because it can be modified easily. This means that editing a linked list works regardless of how many elements are in the list.

[quote]How do you insert a new item in a binary search tree?[/quote]

Assuming that the data to be inserted is a unique value (that is, not an existing entry in the tree), check first if the tree is empty. If it’s empty, just insert the new item in the root node. If it’s not empty, refer to the new item’s key. If it’s smaller than the root’s key, insert it into the root’s left subtree, otherwise, insert it into the root’s right subtree.

[quote]How does a selection sort work for an array?[/quote]

The selection sort is a fairly intuitive sorting algorithm, though not necessarily efficient. In this process, the smallest element is first located and switched with the element at subscript zero, thereby placing the smallest element in the first position.

The smallest element remaining in the subarray is then located next to subscripts 1 through n-1 and switched with the element at subscript 1, thereby placing the second smallest element in the second position. The steps are repeated in the same manner until the last element.

[quote]How do sign and unsigned numbers affect memory?[/quote]

In the case of signed numbers, the first bit is used to indicate whether positive or negative, which leaves you with one bit short. With unsigned numbers, you have all bits available for that number. The effect is best seen in the number range (an unsigned 8-bit number has a range 0-255, while the 8-bit signed number has a range -128 to +127.

[quote]What is the minimum number of nodes that a binary tree can have?[/quote]

A binary tree can have a minimum of zero nodes, which occurs when the nodes have NULL values. Furthermore, a binary tree can also have 1 or 2 nodes.

[quote]What are dynamic data structures?[/quote]

Dynamic data structures are structures that expand and contract as a program runs. It provides a flexible means of manipulating data because it can adjust according to the size of the data.

[quote]In what data structures are pointers applied?[/quote]

Pointers that are used in the linked list have various applications in the data structure. Data structures that make use of this concept include the Stack, Queue, Linked List and Binary Tree.

[quote]What are ARRAYs?[/quote]

When dealing with arrays, data is stored and retrieved using an index that refers to the element number in the data sequence. This means that data can be accessed in any order. In programming, an array is declared as a variable having a number of indexed elements.

[quote]Which sorting algorithm is considered the fastest?[/quote]

There are many types of sorting algorithms: quick sort, bubble sort, balloon sort, radix sort, merge sort, etc. Not one can be considered the fastest because each algorithm is designed for a particular data structure and data set. It would depend on the data set that you would want to sort.

Leave a Reply

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