GeekInterview.com
Series: Subject: Topic:

Data Structures Interview Questions

Showing Questions 1 - 20 of 247 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

Structure and union

Asked By: shruthi20 | Asked On: Jan 17th, 2014

What is the difference between structure and union?

Answered by: bhushanpatil31 on: Apr 6th, 2014

Memory is allocated cumulatively for all members of structure while in case of union, memory for largest element only is allocated

How to reverse a linked list without usinf any pointer of c?

Asked By: noor.lalu | Asked On: May 2nd, 2013

Answered by: shaan on: Mar 30th, 2014

use stack. push all the elements in stack and again insert this elements from stack to linked list. This will be your reverse linked list

How to remove some keys in arraylist

Asked By: mannam haribabu chowdary | Asked On: Aug 26th, 2012

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

Answered by: gourab on: 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.

The front of the stack in a stack-linked list ______________.

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

Skill/topic: stacks using linked lista) back of the linked listb) front of the linked listc) middle of the linked listd) none of the above

Answered by: srishti on: Feb 20th, 2014

top of the stack

Answered by: Shraddha on: Feb 1st, 2014

A)Back of the linked list.

The way a card game player arranges his cards as he picks them up one by one, is an example of 1. Bubble sort 2. Selection sort 3. Insertion sort 4. Merge sort

Asked By: Rujul | Asked On: Mar 25th, 2007

Answered by: ankitschopra on: Nov 4th, 2013

Inserion Sort

Answered by: snyder on: Mar 10th, 2012

Please refer to http://courses.cs.vt.edu/csonline/Algorithms/Lessons/SortingAlgorithms/index.html

it will really help

Consider a linked list implemented of a queue with two pointers: front and rear. What is the time needed to insert an element if the queue is of length n?

Asked By: nehaj1993 | Asked On: Feb 7th, 2013

Answered by: ankitschopra on: Nov 3rd, 2013

In Queue Insertion can only take place in the end. Since we have pointer to front and rear, We only require one step to insert at the rear.

Answered by: Shahnawaz on: Sep 2nd, 2013

O(1). Insert element at rear.

Marbles and floors

Asked By: hari_nowayout | Asked On: Mar 26th, 2011

You have a 100-story building and a couple of marbles. You must identify thelowest floor for which a marble will break if you drop it from this floor. How fastcan you find this floor if you are given an infinite supply of marbles? What if youhave only two marbles?

Answered by: Saurabh on: Sep 6th, 2013

U can use Binary search for this .. First start at last floor say 100 .. If it breaks ( remember we do not know how strong the marble is ) .. then go to floor 50 .. if it breaks go to 25th floor .. if...

Answered by: Shahnawaz on: Sep 2nd, 2013

Solution when we have only two marbles Use below sequence to find out correct floor 14,13,12,11,10,9,........... First drop the first marbel on floor 14th, if marbel breaks go to lower floor till 1s...

What is the size of a void pointer ?

Asked By: anupam verma | Asked On: Dec 4th, 2006

Answered by: Niyas Ibrahim on: 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.

Answered by: jignesh on: 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

Asked By: diwakarprasadbyahut | Asked On: Aug 24th, 2008

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

Answered by: Lovelyn Rose on: 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.

Answered by: Sweetu on: 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...

Transfer function

Asked By: anshul malhotra | Asked On: May 6th, 2013

Relationship between transfer function and homogeneous solution

Answered by: kirankumartana on: Jun 30th, 2013

It is the ratio of laplace transform(input to out put) of any system with out changing time domain

How to check whether linked list is circular?

Asked By: noor.lalu | Asked On: May 2nd, 2013

Answered by: mahesh on: Jun 17th, 2013

get two pointer to head of the list. then increment one pointer by two nodes and other by one node. if list is circular at some point both pointers will be pointing to same node. else u will encounter...

What is the size of char pointer (in bytes)

Asked By: yashwant patel | Asked On: Dec 5th, 2006

Answered by: shivam shrivastava on: Apr 22nd, 2013

In c++, if the pointer object characterized like a type of char ,int or float in array. So the pointer address contains the 2 bytes address.

Answered by: Nidhi on: Feb 19th, 2007

Actually a pointer is just a address holder so its size is always that of an int data type,what ever may be the type of pointer.In a 16-bit compiler,its 2 bytes and in 32-bit compiler,its 4 bytes(ie depeds on sizeof(int))

User stories and use case

Asked By: azeem abdul | Asked On: Apr 2nd, 2013

What is the difference between user stories and a use case

The hashstring() member function is called by other member functions of the hashtable class whenever a function needs to convert a ________________.

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

Skill/topic: hash tablea) a hash number key to a keyb) key to a hash number keyc) a key to an indexexplanation: the hashstring() member function is another function called by other member functions of the hashtable class whenever a function needs to convert a key to a hash number key. The hashstring()...

Answered by: rasheed on: Feb 14th, 2013

C) a key to an Index

Answered by: Sandhya.Kishan on: May 21st, 2012

The hashString() member function is called by other member functions of the Hashtable class whenever a function needs to convert a key to hash number key.

The number of swappings needed to short the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order using bubble sort is 1. 11 2. 12 3. 13 4. 14

Asked By: Rujul | Asked On: Mar 9th, 2007

Answered by: Nitish Kamal on: Jan 27th, 2013

14 is answer

Answered by: Ranjan Kumar Ojha on: Mar 13th, 2007

ans will be 14. you can check. #include<iostream> using namespace std; int main() {     int a[]={ 8, 22, 7, 9, 31, 19, 5, 13 };int counter=0;     for(int i=0;i<...

Getinstance()...

Asked By: Divya6171 | Asked On: Aug 20th, 2012

Please, can anybody answer me that when to use getinstance() and which class having getinstance(),i could not find that method in class class also.

Answered by: RITENDRA on: Nov 1st, 2012

getInstance() method is written inside a class to access the instance of the class from other class. Basically, this is used to ensure that only one instance of the particular class has been created....

Can a linked list store data other than integers?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

Skill/topic: stacks and queues: insert, delete, peek, finda) yesb) noexplanation: integers are usually used, but you can modify the data type of the data in the definition of the node to change the kind of data stored in the linked list.

Answered by: real on: Oct 18th, 2012

When we are using structure variable then i will say yes!

Code
  1. struct node{
  2. int info;
  3. string name;
  4. float average;
  5. node *node;
  6. };

Answered by: Rahul Goyal on: Jul 20th, 2012

link list is a data structure not a property of integers...
so, the data the it store can be anything like a class object or structure object etc.

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

Asked By: Rajasekhar | Asked On: Sep 25th, 2011

Answered by: rjshkr on: 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 = ...

Answered by: Rahul goyal on: 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.  

What happens if an invalid index value is passed to a function?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

Skill/topic: stacks and queues: insert, delete, peek, finda) if an invalid index is passed, the function terminates without further processing. [explanation] functions that use an index value always determine if the index passed to them is valid before using the index value . If an invalid index is...

Answered by: Sandhya.Kishan on: Jul 25th, 2012

If the user passes in an invalid index, the program will cause an assertion error. While this is useful to indicate to the user that something went wrong, so they can deal with it as appropriate.

Iterative algorithm

Asked By: zoya | Asked On: Oct 22nd, 2011

Design an iterative algorithm to traverse a binary tree represented in two dimensional matrix

Answered by: Sandhya.Kishan on: Jul 16th, 2012

A binary tree can be traversed using only one dimensional array. InOrder_TreeTraversal() { prev = null; current = root; next = null; while( current != null ) { if(prev == current.parent) { prev = cu...

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.