Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Devise a representation for a given list where insertions and deletions can be made at both the ends. Such a structure is called Deque (which means Double ended queue). Write functions for inserting and deleting at both the ends.
Ans:
struct Deque
{
int info;
struct Deque *left, *right;
}*head, *tail;
add(struct Deque *p, int x)
struct Deque *temp;
temp = malloc (sizeof(struct Deque), 1);
temp -> info = x;
if(p == head)
temp->right = head; temp->left = NULL; head->left = temp;
head = temp;
}
else if(p == tail)
temp->left = tail; temp->right = NULL; tail->right = temp; tail = temp;
delete(struct Deque *p, int x)
temp = head;
head = head->right;
head->left = NULL; temp->right = NULL; free(temp);
temp = tail;
tail = tail->left; tail->right = NULL; temp->left = NULL; free(temp);
Adjacency list representation An Adjacency list representation of Graph G = {V, E} contains an array of adjacency lists mentioned by adj of V list. For each of the vertex u?V,
Q. The reason bubble sort algorithm is inefficient is that it continues execution even after an array is sorted by performing unnecessary comparisons. Therefore, the number of comp
Define Strictly Binary Tree Strictly Binary Tree: - If each non leaf node in binary tree has non empty left and right sub-trees , then the tree is known as a strictly binary t
Explain the array and linked list implementation of stack
Define about the class invariant A class invariant may not be true during execution of a public operation though it should be true between executions of public operations. For
Decision Tree - ID3 algorithm: Imagine you only ever do one of the following four things for any weekend: go shopping watch a movie play tennis just
write an algorithm to search a particular node in linked list which returns " FOUND" or "NOT FOUND" as outcome.
A Red-Black Tree (RBT) is a type of Binary Search tree with one extra bit of storage per node, i.e. its color that can either be red or black. Now the nodes can have any of the col
Tree is dynamic data structures. Trees can expand & contract as the program executes and are implemented via pointers. A tree deallocates memory whereas an element is deleted.
Define Big Theta notation Big Theta notation (θ) : The upper and lower bound for the function 'f' is given by the big oh notation (θ). Considering 'g' to be a function from t
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd