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()...
C) a key to an Index
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.
14 is answer
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<...
What is the size of a void pointer ?
Size of void pointer or size of character pointer are same because both variable contain address or we can say memory location
all pointers are the same size, they only differ on the platform and the amount memory you are trying to address. for example, on an 8051 platform it's 3 bytes, on an intel it's 32 or 64 bits wide.
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.
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....
The front of the stack in a stack-linked list ______________.
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
Top of stack
B) Front of the linked list i.e top
Can a linked list store data other than integers?
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.
When we are using structure variable then i will say yes!
Code
struct node{ int info; string name; float average; node *node; };
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?
"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 = ...
Code
//let the structure name be stud void insert_pos(stud *head, pos) { stud s,*t; s.input(); //accept the data t=head; pos--; while(t!=NULL && pos) { t=t->next; pos--; } s->next=t->next; t->next=s; }
What happens if an invalid index value is passed to a function?
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...
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.
Design an iterative algorithm to traverse a binary tree represented in two dimensional matrix
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...
Why resultset being an interface can call next()
A class which implements an interface implements its methods.When we obtain a reference to a ResultSet then we are getting an instance of a class that implements the ResultSet interface.Hence class provides concrete implementations of all of the ResultSet methods.
While creating a heterogenous linklist we know that we use void pointer. But when we need to read the information, how will you do it? How will you figure out to what datatype does the data belong to?
Some kind of information regarding the type is obviously required. If there is no way of determining it from the context (i.e., the previous node in the list somehow specifies the type), it must be st...
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?
Sounds like a simple binary search to me. For 100 floors, you would need at most 7 marbles to reach an answer. More generally, with n floors, you would need ceiling(Log2(n+1)) marbles. If the floors ...
1. Crisp binary choices 2. Ambiguous data 3. Decision makers 4. All of them
Fuzzy logic system relays on all Crisp binary data, ambiguous data and on decision makers.
Why are data members of the hashtable class stored in the priVATe access specifier?
Skill/topic: hash tablea) data members of the hashtable class are stored in the priVATe access specifier to ensure the integrity of the data. Only member functions can assign and retrieve values of these data members.
The data members of the hashtable class stored in the priVATe access specifier as members can be used by the class itself or by friends.It ensure data integrity.If the members are declared as private then only mamber functions can assign and retrive values.
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?
Answered by: hrshksh
Member Since May-2010 | Answered On : 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).
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...
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...
Write a code how to implement stack using two queues? and vice versa ?
"c 1.queue_t q0; 2.queue_t q1; 3. 4.void stack_push(void *t) { 5. // At any given time one queue will be empty 6. queue_t *curr = (q0.isEmpty() ? q1 : q0); 7. 8. curr.push(t);...
something like this:"c queue_t q0; queue_t q1; void stack_push(void *t) { // At any given time one queue will be empty queue_t *curr = (q0.size() ? q0 : q1); curr.push(t); ...
Conceptually, a linked list queue is the same as a queue built using an array.
Skill/topic: queues using linked listsa) trueb) falseexplanation: conceptually, a linked list queue is the same as a queue built using an array. Both store data. Both place data at the front of the queue and remove data from the front of the queue
A FIFO (first in, first out) structure means data is added to the back of the queue and removed from the front of the queue. A first in first out structure is equivalent to last in last out structure,...
A queue built using array is same as a linked list queue because both insert the data in the front and delete the data from front of the queue,i.e,both follow fifo data structure.
Why is it important to enhance the functionality of the linkedlist class?
Skill/topic: stacks and queues: insert, delete, peek, finda) you enhance the functionality of linkedlist class to more easily manipulate a linked list
To increase the efficiency of the linkedliss class and to allow easy manipulations on the linked list we should enhance the functionality of the class.
The removenodeat() function removes a node by using the node’s index?
Skill/topic: stacks and queues: insert, delete, peek, finda) trueb) falseexplanation: the removenodeat() function removes a node by using the node’s index rather than the reference to the node in memory
True, the removenodeat() function removes a node by using the nodes index and not by the the reference to the node in memory.
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.
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))