Data Structures Interview Questions

Showing Questions 1 - 20 of 20 Questions
Sort by: 
 | 
Jump to Page:
  •  

    How to remove some keys in ArrayList

    Hi.
    This a class Employee containes eid and ename are datamembers. when these employee class objects are stored in arrary list
    i want to remove eid containes 100 and 1000
    plz replay to me

    gourab

    • Mar 14th, 2014

    Use varray or nestet table to store the array list.
    the if want to remove use DELETE(n) method to specify the element to remove from the list.

  •  
  •  

    What is the size of a void pointer ?

    Niyas Ibrahim

    • Sep 2nd, 2013

    Use of pointer is to store a memory address.since any location in the memory have same type(characters or digits) of memory address, size is same for all pointer types.

    jignesh

    • Dec 29th, 2012

    Size of void pointer or size of character pointer are same because both variable contain address or we can say memory location

  •  

    Linear and Non-Linear Data Structures

    Explain what are linear data structure & non-linear data structure?

    Lovelyn Rose

    • Jul 2nd, 2013

    In a linear data structures, if we traverse from an element, we can strictly reach only one other element. In a non-linear data structure, traversing from an element can lead lead to more than one element.

    Sweetu

    • Aug 13th, 2011

    Linear data structure: A linear data structure traverses the data elements sequentially, in which only one data element can directly be reached. Ex: Arrays, Linked Lists Non-Linear data structure: Ev...

  •  

    Write a program to insert a node at a given position in a single linked list?

    rjshkr

    • Sep 28th, 2012

    "c NODE insert(NODE head,int data,int pos) { NODE temp,new,prev = NULL; int i=1; new = (NODE)malloc(sizeof(struct node)); new->info = data; if(head == NULL) { new->link = ...

    Rahul goyal

    • Jul 20th, 2012

    Code
    1. //let the structure name be stud
    2. void insert_pos(stud *head, pos)
    3. {
    4.   stud s,*t;
    5.  s.input(); //accept the data
    6.  t=head;
    7. pos--;
    8. while(t!=NULL && pos)
    9. {
    10.   t=t->next;
    11.    pos--;
    12. }
    13. s->next=t->next;
    14. t->next=s;
    15. }
    16.  

  •  

    Data Structure for one million named objects

    If you have one million named objects and you want to store them in a data structure that lets you insert new objects quickly and search for an object by name quickly, what data structure should you use?

    Star Read Best Answer

    Editorial / Best Answer

    hrshksh  

    • Member Since May-2010 | May 9th, 2010


    It depends on the amount of primary memory one has for the process. If we can store 1 million records in primary memory, then we can very well take a hash table with a consistent hashing scheme for avoiding collisions. It will take O(1). 


    In most cases however this is not possible. In circumtances like this, there are two ways:
    B Trees or Extensible Hashing both of them have interesting time complexities.


    ptmich

    • May 28th, 2012

    You can use a hash table or an array of objects You can use an array of objects because you already know that you need to store a specified number of objects, also you can store and access objects qu...

    hrshksh

    • May 9th, 2010

    It depends on the amount of primary memory one has for the process. If we can store 1 million records in primary memory, then we can very well take a hash table with a consistent hashing scheme for av...

  •  

    Why does QueueLinkedList class inherit the LinkedList class?

    Skill/Topic: Queues Using Linked ListsA) The QueueLinkedList class inherits the LinkedList class because the LinkedList class contains data members and function members that are necessary to manage the linked list that is used for the queue.

  •  

    Time Complexity of Adding Three Matrices

    What is the time complexity of adding three matrices of size NXN cell-by-cell?

    Manish Yadav

    • Oct 15th, 2011

    Time Complexity of Adding Three Matrices because there is only two loop are needed for adding the matrix so complexity will be o(n^2), there is no effect for increase the number of matrix. it will be same for n number of matrix.

    Code
    1. algo like this.......
    2.  
    3. for(i=0;i<n;i++)
    4. {
    5.  for(j=0;j<n;j++)
    6.  {
    7.    result[i][j]=a[i][j]+b[i][j]+c[i][j]+...........................z[i][j];
    8.  }
    9. }
    10.  

    sonia_mehta

    • Jul 6th, 2010

    Program looks like......for(i=0;i<n;i++){ for(j=0;j<n;j++) {   result[i][j]=a[i][j]+b[i][j]+c[i][j]; }}loop will execute n*n times...and 2 add operations..if 1 add op takes 'c' time, thentotal time= 2*c*n*nthus, time complexity= n*n......

  •  

    Equivalent Pointer Expression

    What is the equivalent pointer expression for referring the same element a[i][j][k][l]

    KS111

    • Jun 21st, 2010

    Similar to what Shekhar has already mentioned, with a small correction:To print the value of a[i][j][k][l], we need to use *(*(*(*(a+i) + j) + k) + l).Explanation:Let us first take a simple example of...

  •  

    What are the advantages of a database approach compared to a flat file system?