Data Structure interview questions


31. What is linear search or sequential search?
In computer science, a linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched.

32. What is binary search?
In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array.

33. What is a Memory pool?
Memory pools, also called fixed-size blocks allocation, is the use of pools for memory management that allows dynamic memory allocation comparable to malloc or C++’s operator new. As those implementations suffer from fragmentation because of variable block sizes, it is not recommendable to use them in a real time system due to performance. A more efficient solution is preallocating a number of memory blocks with the same size called the memory pool. The application can allocate, access, and free blocks represented by handles at run time.

34. What are the drawback of sequential access?
The biggest drawback of sequential access is that it’s very slow. You will see sequential access mostly in backup tapes, or the big, clunky magnetic tapes that are used to backup large amounts of data. For this purpose, the method is acceptable because the speed of access isn’t important.Fixed amount of storage remains allocated to the data structure even if it contains less data.

35. What is a Circular linked list?
Circular linked list is a sequence of elements in which every element has link to its next element in the sequence and the last element has a link to the first element in the sequence. That means circular linked list is similar to the single linked list except that the last node points to the first node in the list.

Author: user

Leave a Reply

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