C and data structures interview questions pdf
What is data structure? List out the areas in which data structures are applied extensively? What is the data structures used to perform recursion? Insertion, selection, exchange, deletion sorting is not possible in deletion. What are the methods available in storing sequential files? What is the type of the algorithm used in solving the 8 queens problem? In an aVl tree, at What condition the balancing is to be done? What is a spanning tree? Which is the simplest file structure?
Whether linked list is linear or non-linear data structure? It is a collection of data elements called nodes, where each node is divided into three parts: an info field that contains the information stored in the node.
Right field that contain pointer to node on right side. Is It necessary to sort a file before searching a particular Item? If frequent use of the file is required for the purpose of retrieving specific element, it is more efficient to sort the file.
What are the Issues that Hamper the efficiency In sorting a file? Is any Implicit arguments are passed to a function When It Is called? What Is the data structures used to perform Recursion? What Is the type of the algorithm used In solving the 8 queens problem? In an avl tree, at What condition the balancing Is to be done? In general: there are 2n-1 nodes in a full binary tree. What Is a spanning tree?
Rdbms array i. Which file contains the definition of member functions? How Is any data structure application Is classified among files? What member function places a new node at the end of the linked list? What Is linked list? What does each entry In the link list called? How Is the front of the queue calculated? Why Is the Isempty member method called? Which process places data at the back of the queue? What Is the Relationship between a queue and Its underlying array?
What Is a queue? What does Isempty member method determines? What method Removes the Value from the top of a stack? What method Is used to place a Value onto the top of a stack? Run time memory allocation Is Known as?
How do you assign an address to an element of a pointer array? Why do We use a multidimensional array? Is pointer a Variable? How many parts are there In a declaration statement?
How memory Is Reserved using a declaration statement? What Is Impact of signed numbers on the memory? What Is precision? What Is the difference between null and Void pointer? What Is the difference between array and stack? Whether linked list Is linear or non-linear data structure? Each assignment statement must have an lvalue and an rvalue.
The lvalue expression must refer a storable variable in memory. It cannot be a constant. An ordinary Doubly Linked List requires space for two address fields to store the addresses of previous and next nodes. A memory efficient version of Doubly Linked List can be created using only one space for address field with every node. In the XOR linked list, instead of storing actual memory addresses, each node stores the XOR of addresses of previous and next nodes.
Trie is efficient information retrieval data structure. Using trie, search complexities can be brought to optimal limit key length. The main idea of splay tree is to bring the recently accessed item to root of the tree. This makes the recently searched item to be accessible in O 1 time if accessed again. Imagine a situation, where we have millions or billions of keys and only few of them are accessed frequently, which is very likely in many practical applications.
All splay tree operations run in O log n time on average, where n is the number of entries in the tree. Any single operation can take Theta n time in the worst case. The idea is to use Randomization and Binary Heap property to maintain balance with high probability. The expected time complexity of search, insert and delete is O Log n. Each node of Treap maintains two values.
We are given total possible page numbers that can be referred. We are also given cache or memory size Number of page frames that cache can hold at a time.
The LRU caching scheme is to remove the least recently used frame when the cache is full and a new page is referenced which is not there in cache. We use two data structures to implement an LRU Cache. Linear solution is possible. Have two pointers say P1 pointing to the first node of L1 and P2 to that of L2. Traverse through both the lists. By doing this, we are balancing the difference in the length between the linked lists. Finally, they will meet at the Intersection node. Browsers are available at no charge and are easy to install.
If you can't update your browser, install a new browser, or update your operating system, try to use a different computer or use a mobile device. The issues are: Length of time required by the programmer in coding a particular sorting program. Amount of machine time necessary for running the particular program. The amount of space necessary for the particular program. Read C programming tutorial to learn about various operators in C. What is the difference between sprintf … writes data to the character array.
A goto statement implements a local jump of program execution whereas the longjmp and setjmp functions implement a nonlocal or far jump of the program execution. Generally, a jump in any execution should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program.
A goto statement simply bypasses code in your program and jumps to a predefined position. To use the goto statement, you give it a labeled position to jump to.
This predefined position must be within the same function. You cannot implement goto between functions. Unlike the goto statement, the longjmp and setjmp functions do not need to be implemented in the same function. There is a major drawback of using these functions: your program, when restored to its previously saved state, it will lose its references to any dynamically allocated memory between the longjmp and the setjmp. This means you will waste memory for every malloc or calloc you have implemented between your longjmp and setjmp , and your program will be inefficient.
It is highly recommended that you avoid using functions such as longjmp and setjmp because they, like the goto statement, are quite often an indication of poor programming practice. Know more about C Functions in this riveting tutorial. What is XOR linked list? Using trie, we can search the key in O M time. However, the penalty is on trie storage requirements. Each node of trie consists of multiple branches. Each branch represents a possible character of keys.
We need to mark the last node of every key as leaf node. A trie node field value will be used to distinguish the node as leaf node there are other uses of the value field. What do you understand by splay tree? Go through this C Video to get clear understanding of C Programming. What is Treap?
Key follows standard BST ordering left is smaller and right is greater Priority Randomly assigned value that follows Max-Heap property.
How to implement LRU caching scheme? What data structures should be used? A 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.
When a page is referenced, the required page may be in the memory. If it is in the memory, we need to detach the node of the list and bring it to the front of the queue. If the required page is not in the memory, we bring that in memory.
In simple words, we add a new node to the front of the queue and update the corresponding node address in the hash.
0コメント